Get an asset's global state by id.
curl --request GET \
--url https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state \
--header 'Authorization: Bearer <token>'import requests
url = "https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state', 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/track/v2/assets/{id}/global-state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"message": "Asset found",
"data": {
"trackID": "did:trustos:trackid:<id>",
"assetId": "asset-test-01",
"data": {
"id": "A2839RP",
"version": "1"
},
"networkId": 10004,
"assetHash": "3c543e352981fabafc8a78a301cd116320010a13abe8abf8428eaedcee7ddabd",
"globalState": {
"color": "red",
"position": {
"x": "23.34",
"y": "-24.22"
}
}
}
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "Token is not provided"
}{
"statusCode": 404,
"type": "Not Found Error",
"message": "Asset not found"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}Asset Management
Get Global State
Gets the assets’s global state.
GET
/
assets
/
{id}
/
global-state
Get an asset's global state by id.
curl --request GET \
--url https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state \
--header 'Authorization: Bearer <token>'import requests
url = "https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state', 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/track/v2/assets/{id}/global-state",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://lab.trustos.telefonicatech.com/track/v2/assets/{id}/global-state")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"statusCode": 200,
"message": "Asset found",
"data": {
"trackID": "did:trustos:trackid:<id>",
"assetId": "asset-test-01",
"data": {
"id": "A2839RP",
"version": "1"
},
"networkId": 10004,
"assetHash": "3c543e352981fabafc8a78a301cd116320010a13abe8abf8428eaedcee7ddabd",
"globalState": {
"color": "red",
"position": {
"x": "23.34",
"y": "-24.22"
}
}
}
}{
"statusCode": 401,
"type": "Authentication Error",
"message": "Token is not provided"
}{
"statusCode": 404,
"type": "Not Found Error",
"message": "Asset not found"
}{
"statusCode": 500,
"type": "Internal Server Error",
"message": "Oops! Something went wrong, please try again later"
}The global state is formed by all metadata properties of the transactions. In case that any property has been updated, the global state will have the most recent value.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Identifier of the asset.
Example:
"did:trustos:trackid:<id>"
Was this page helpful?
⌘I