Change access properties of a certificate.
curl --request PATCH \
--url https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"public": true,
"certificatePin": "1234",
"externalId": "extcertid"
}
'import requests
url = "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}"
payload = {
"public": True,
"certificatePin": "1234",
"externalId": "extcertid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({public: true, certificatePin: '1234', externalId: 'extcertid'})
};
fetch('https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'public' => true,
'certificatePin' => '1234',
'externalId' => 'extcertid'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}"
payload := strings.NewReader("{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"message": "Certificate access properties updated",
"data": "The access properties of the certificate with certID 'did:<env>:certid:<id>' have been updated."
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "User credentials are wrong"
}{
"statusCode": 403,
"type": "Forbidden Error",
"message": "User is not qualified, please try again with a qualified user"
}{
"statusCode": 404,
"type": "Not Found Error",
"message": "Certificate with certId {certId} not found"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Certificate Management
Change Access Properties
Changes the access properties of a certificate.
PATCH
/
certificates
/
{type}
/
{id}
Change access properties of a certificate.
curl --request PATCH \
--url https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"public": true,
"certificatePin": "1234",
"externalId": "extcertid"
}
'import requests
url = "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}"
payload = {
"public": True,
"certificatePin": "1234",
"externalId": "extcertid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({public: true, certificatePin: '1234', externalId: 'extcertid'})
};
fetch('https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'public' => true,
'certificatePin' => '1234',
'externalId' => 'extcertid'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}"
payload := strings.NewReader("{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/cert/v2/certificates/{type}/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"public\": true,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"message": "Certificate access properties updated",
"data": "The access properties of the certificate with certID 'did:<env>:certid:<id>' have been updated."
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "User credentials are wrong"
}{
"statusCode": 403,
"type": "Forbidden Error",
"message": "User is not qualified, please try again with a qualified user"
}{
"statusCode": 404,
"type": "Not Found Error",
"message": "Certificate with certId {certId} not found"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Use Cases
Make a certificate public
In order to make a certificate public, the body propertypublic should be set to true.
Make a certificate private or change the certificate pin
In order to make a certificate private or change the certificate PIN, the body propertycertificatePin should be passed with the desired PIN.
Change externalId
In order to change the externalId of a certificate, the body propertyexternalId should be passed with the desired externalId.
Delete externalId
In order to delete the externalId of a certificate, the body propertyexternalId should be passed with null.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Type of the certificate identifier.
Available options:
certID, externalId, fileHash, hash Identifier of the certificate.
Example:
"123"
Query Parameters
PIN of the certificate (if the certificate is private).
Example:
"1234"
Body
application/json
Data needed to change the access properties of a certificate.
Response
Successful certificate access properties update.
Was this page helpful?