curl --request POST \
--url 'https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Certificate",
"description": "Certificate description",
"assetId": "asset-01",
"from": 1234567,
"to": 1234567,
"content": {},
"public": true,
"expires": 1234567890,
"certificatePin": "1234",
"externalId": "extcertid"
}
'import requests
url = "https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset"
payload = {
"name": "Certificate",
"description": "Certificate description",
"assetId": "asset-01",
"from": 1234567,
"to": 1234567,
"content": {},
"public": True,
"expires": 1234567890,
"certificatePin": "1234",
"externalId": "extcertid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Certificate',
description: 'Certificate description',
assetId: 'asset-01',
from: 1234567,
to: 1234567,
content: {},
public: true,
expires: 1234567890,
certificatePin: '1234',
externalId: 'extcertid'
})
};
fetch('https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset', 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=asset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Certificate',
'description' => 'Certificate description',
'assetId' => 'asset-01',
'from' => 1234567,
'to' => 1234567,
'content' => [
],
'public' => true,
'expires' => 1234567890,
'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=asset"
payload := strings.NewReader("{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 201,
"message": "Certificate created",
"data": {
"certID": "did:local:certid:123124",
"data": {
"name": "Certificate",
"description": "Certificate description",
"content": {},
"issuer": "did:user:{issuer}",
"issuedOn": 1696840286580,
"hash": "a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142",
"expires": 1696840286580
},
"metadata": [
{
"networkId": 10004,
"smartContract": "0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc",
"transactionHash": "0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc",
"trustPointHash": "a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142",
"timestamp": 1696840286580
}
],
"access": {
"certificatePin": "1234",
"externalId": "extcertid"
}
}
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error"
}{
"statusCode": 403,
"type": "Forbidden Error"
}{
"statusCode": 409,
"type": "Existing certificate error"
}{
"statusCode": 429,
"type": "Out of Credits Error",
"message": "User has run out of credits. Please, contact BTeam to increase the limit"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Create Asset Certificate
Creates a certificate from an existing Track API asset.
curl --request POST \
--url 'https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Certificate",
"description": "Certificate description",
"assetId": "asset-01",
"from": 1234567,
"to": 1234567,
"content": {},
"public": true,
"expires": 1234567890,
"certificatePin": "1234",
"externalId": "extcertid"
}
'import requests
url = "https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset"
payload = {
"name": "Certificate",
"description": "Certificate description",
"assetId": "asset-01",
"from": 1234567,
"to": 1234567,
"content": {},
"public": True,
"expires": 1234567890,
"certificatePin": "1234",
"externalId": "extcertid"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Certificate',
description: 'Certificate description',
assetId: 'asset-01',
from: 1234567,
to: 1234567,
content: {},
public: true,
expires: 1234567890,
certificatePin: '1234',
externalId: 'extcertid'
})
};
fetch('https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset', 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=asset",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Certificate',
'description' => 'Certificate description',
'assetId' => 'asset-01',
'from' => 1234567,
'to' => 1234567,
'content' => [
],
'public' => true,
'expires' => 1234567890,
'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=asset"
payload := strings.NewReader("{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/cert/v2/certificates?type=asset")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Certificate\",\n \"description\": \"Certificate description\",\n \"assetId\": \"asset-01\",\n \"from\": 1234567,\n \"to\": 1234567,\n \"content\": {},\n \"public\": true,\n \"expires\": 1234567890,\n \"certificatePin\": \"1234\",\n \"externalId\": \"extcertid\"\n}"
response = http.request(request)
puts response.read_body{
"statusCode": 201,
"message": "Certificate created",
"data": {
"certID": "did:local:certid:123124",
"data": {
"name": "Certificate",
"description": "Certificate description",
"content": {},
"issuer": "did:user:{issuer}",
"issuedOn": 1696840286580,
"hash": "a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142",
"expires": 1696840286580
},
"metadata": [
{
"networkId": 10004,
"smartContract": "0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc",
"transactionHash": "0xabcdbcbff5fa05e060e7dfe3e608cba010d11abc",
"trustPointHash": "a2ac9343a3d94e41bbc5c152fb8382c5233a47cee23cf765c7e6d67d9e61a142",
"timestamp": 1696840286580
}
],
"access": {
"certificatePin": "1234",
"externalId": "extcertid"
}
}
}{
"statusCode": 400,
"type": "Validation Error",
"message": "Request parameters are wrong, check requirements",
"errors": [
{
"field": "",
"error": ""
}
]
}{
"statusCode": 401,
"type": "Authentication Error"
}{
"statusCode": 403,
"type": "Forbidden Error"
}{
"statusCode": 409,
"type": "Existing certificate error"
}{
"statusCode": 429,
"type": "Out of Credits Error",
"message": "User has run out of credits. Please, contact BTeam to increase the limit"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Flag that indicates whether the certificate should be qualified sign.
true, false Network identifier where the trustpoint will be registered.
10004
Body
Data needed for the creation of a certificate from an asset.
Name of the certificate.
"Certificate"
Description of the certificate.
"Certificate description"
Identifier of the asset that is going to be certified.
"asset-01"
Timestamp from which to start retrieving asset transactions to certify.
1234567
Timestamp from which to stop retrieving asset transactions to certify.
1234567
Additional content properties of the certificate.
{}
Flag that indicates whether the certificate is public or not.
true
Timestamp of the expiration date of the certificate.
1234567890
PIN of the certificate.
"1234"
Custom identifier of the certificate.
"extcertid"
Was this page helpful?