Use the Digital Asset API

This section lists the available Digital Asset API routes and their mandatory parameters.

Note

Where an application key is required, you must first create a JWT token for the ng-rt-digitalAsset plugin to execute these routes. Add the JWT token for ng-rt-digitalAsset to the headers in your request. Where user authentication is required, you will require user authentication, explained in the first call below.

Quick reference - chart

These routes will be described in detail.

Method Route Short Description
Create, see or transfer a digital asset
POST  /ng-rt-digitalAsset/assets creates a digital asset
POST  /ng-rt-digitalAsset/assets/app creates a digital asset with an application key
GET  /ng-rt-digitalAsset/assets gets all assets within a limit
GET  /ng-rt-digitalAsset/assets/time gets all assets for a specified time range
POST  /ng-rt-digitalAsset/assets/file creates a file asset
GET  /ng-rt-digitalAsset/assets/app/:id retrieves a digital asset by asset ID (requires application key)
POST  /ng-rt-digitalAsset/assets/:id/transfer transfers asset
POST  /ng-rt-digitalAsset/assets/app/:id/transfer transfers asset by application key
GET  /ng-rt-digitalAsset/assets/:id/history retrieves transaction history of the specified digital asset
GET  /ng-rt-digitalAsset/assets/hash/:txId retrieves a digital asset with transaction ID 
GET  /ng-rt-digitalAsset/assets/:id/owner gets current owner of an asset
GET  /ng-rt-digitalAsset/assets/file/:fileId retrieves specified file asset
GET  /ng-rt-digitalAsset/assetsByProperty finds assets by specified property
Obtain, create or delete asset definitions
POST  /ng-rt-digitalAsset/assetDefinitions creates a new asset definition 
GET  /ng-rt-digitalAsset/assetDefinitions/:name retrieves asset definition
GET  /ng-rt-digitalAsset/assetDefinitions retrieves all asset definitions
POST  /ng-rt-digitalAsset/assetDefinitions creates a asset definition
DELETE  /ng-rt-digitalAsset/assetDefinitions removes a asset definitions
Obtain information for a public key
GET  /ng-rt-digitalAsset/accounts/:address/balance gets balance for public key
GET  /ng-rt-digitalAsset/accounts/:address/balance/:assetId gets balance by asset id for public key
GET  /ng-rt-digitalAsset/accounts/:public_key/txHistory gets transaction history for public key
GET  /ng-rt-digitalAsset/accounts/:address/assets gets all assets belonging to an owner public key
Get block information
GET  /ng-rt-digitalAsset/blocks/hash/:blockHash retrieves block by block hash
GET  /ng-rt-digitalAsset/blocks/height/:blockHeight retrieves block by block height
GET  /ng-rt-digitalAsset/blocks/heights gets all blocks for a specified range of heights
GET  /ng-rt-digitalAsset/blocks/time gets all blocks for a specified time range
GET  /ng-rt-digitalAsset/blocks gets all blocks within a limit
GET  /ng-rt-digitalAsset/blocks/count gets total number of blocks
Get transaction information
GET  /ng-rt-digitalAsset/transactions gets all transactions within a specified limit
GET  /ng-rt-digitalAsset/transactions/hash/:txHash  gets transaction by hash
GET  /ng-rt-digitalAsset/transactions/time gets all transactions for a specified time range
GET  /ng-rt-digitalAsset/transactions/count gets total number of transactions
GET  /ng-rt-digitalAsset/transactions/app/:id gets transactions by application key
GET  /ng-rt-digitalAsset/transactionsByProperty  finds transaction by specified property
Other calls
GET  /ng-rt-digitalAsset/config gets public values for the plugin
GET  /ng-rt-digitalAsset/chain/nodes gets information about network nodes

To use the routes listed above, you will need to obtain an app key token or get user authentication, described below. 

Get your app key token

These calls use the application token ng-rt-digitalAsset for authentication.

This call provides you the application token for ng-rt-digitalAsset:

POST /auth/applogin

he following body parameters are mandatory:

  • "appID":"ng-rt-digitalAsset"
  • "appKey":"<generated_app_key>"

The response will return a JWT token needed for calls that require application authentication.

User authentication

This call logs you in as a user. Use this route:

POST /auth/login

The following body parameters are mandatory:

  • username
  • password

The response will return a JWT token. This token is needed for calls that require user authentication.