Getting Assets
On this page
GET /assets/{assetId}
Retrieving an individual Notardec record is one on the most frequent operations on the Notardec API. Being just a read operation it doesn’t involve signing a request. See the sample request and response below:
Code example
export async function getAsset(apiKey: string, token: string, assetId: string, details = true): Promise<IResponse<AssetResponse>> {
let url = `${process.env.NOTARDEC_URL}/assets/${assetId}`;
if (details) {
url = `${process.env.NOTARDEC_URL}/assets/${assetId}?details=true`;
}
const result = await axios.get<IResponse<AssetResponse>>(url, {
headers: token
? {
Authorization: `Bearer ${token}`,
'X-API-KEY': apiKey,
}
: {
'X-API-KEY': apiKey,
},
});
return result.data;
}
First and second parameter are as usual the Notardec API key and the optional user-token. The third is the Asset id, the fourth is details. The Asset id is actually a uint96, represented in Hex. But it must be passed as a string. The response body will have the following form:
export interface IResponse<T> {
value: T | null;
meta?: MetaResponse;
error?: ErrorResponse;
}
export interface AssetResponse {
id: string;
author: string;
name: string;
description: string;
language: string;
jurisdiction: string;
unotOfMeasure: string;
sparkFactor: string;
sparkFactorModifier: string;
assetClass: string;
createdOn: Date;
updatedOn: Date;
blockchainHash: string;
documentDbHash: string;
transactionId: string;
customDefinitionItems?: AssetCustomDefinitionItems[];
}
Real asset example
{
id: '0d80c1ea41b73a57db90a0001',
name: 'Hello world asset 1',
author: '0x943d7c1b12d7241598f1bf3fcc5d27a8ad2cc096',
description: 'Notardec Asset',
language: 'en',
jurisdiction: 'EARTH',
unitOfMeasure: 'token',
sparkFactor: '1',
sparkFactorModifier:
'{"type":"FORMULA","start":"2021-09-21T12:11:08Z","t":"1d","f":"1"}',
assetClass: 'A017',
createdOn: '2021-09-21T14:27:44.7828091+02:00',
updatedOn: '2021-09-21T14:27:44.7828091+02:00',
blockchainHash:
'0xa21d0889b90e745516416e13adbb9a8fbfe9fde20e92bd9ee2f728028ae50fcc',
documentDbHash:
'a21d0889b90e745516416e13adbb9a8fbfe9fde20e92bd9ee2f728028ae50fcc',
customDefinitionItems: [
{
key: 'data',
type: 'TEXT',
value: 'Lorem ipsum 111',
name: 'Data',
sectionsPath: '[documentation]',
sectionsPathNames: '[Documentation]',
},
],
transactionId: '03e1da13-aed0-4b46-4708-08d97cc96d25',
assetLinkIds: ['0cf3e2e5f35b8d6cf47aa0001'],
}
The response is forwarded without any changes from the TEOS API, which is why you see additional properties. These properties are based on the generic TEOS Asset definition and are applicable to all kinds of assets available on the TEOS platform (with and without quantity, fractionalized, non-fungible, bundled, etc.) The assetClass A017 refers to a “document”. The sparkFactor defines the fractionalization (NOTRZR doesn’t handle fractions or units). The customDefinitionItems leaf contains the “data” element as well as the file-properties, in case content was provided. Currently all records have “english” as their base-language. Being a non-financial asset, the jurisdiction does not matter. “Planet Earth” is the default value. Unless the properties are described in the Asset creation method you can’t modify them.