Getting Started
IntroductionVision and MissionFor Users
Nodle IoTNodle AppNodle ClientNodle on zkSync EraNodle PortalNODL TokenNFT Minting ToolNodle ExplorerParticipateFor Developers
SubQuery IndexerNodle APIsNodle ParachainParachain ModulesNodle SDKNodle Android SDKNodle iOS SDKSmart MissionsMore Info
AppendixGlossaryIntroduction to Nodle APIs
Nodle has several APIs you can use to connect with the Nodle Network or the services built on it.
- The SDK API and IoT API may be used by enterprise customers to manage their SDK instances and interact with the Asset Tracking service.
- The Treasury Allocations API, Token Issuance API and SubQL indexer API may be used to query various states and statistics about the Nodle Chain.
IoT API
Getting started
We consider that at this point, you are already onboarded on the IoT dashboard and that you have organizations created.
APIs
Please note that there are two different APIs :
- SDK API: manage your account, your organizations, your API keys,...
- Base URL :
https://api.sdk.nodle.io/api/v1/
- IoT API: retrieve data from your fleets and devices.
- Base URL :
https://iot.nodle.com/api/v1/
In order to use the IoT API, you will have to create an API key directly from SDK API. Everything is described in the following steps.
SDK API authentication
Go to IoT dashboard or SDK dashboard and sign in using your email. Right after, you should receive an email containing a magic link that should looks like https://iot.nodle.com/?token={token}
. Please copy this token
, we will need it to authenticate requests later.
Note: Please note that the magic link's URL will always look like https://iot.nodle.com/?token=******
or https://sdk.nodle.com/?token=******
, every other link format should be considered as phishing.
Create your API key
Once you have your token
, you will be able to create your API key with /api/v1/currentuser/apikeys
SDK API endpoint:
curl -X 'POST' \
'https://api.sdk.nodle.io/api/v1/currentuser/apikeys' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {YOUR_TOKEN}' \
-H 'Content-Type: application/json' \
-d '{
"displayName": "My First API Key!"
}'
If your request is valid, you will receive your newly created API key:
{
"id": 1234567,
"display_name": "My First API Key!",
"apikey": "{YOUR_API_KEY}",
"created_on": "2022-12-20T07:58:26.198146239Z",
"updated_on": "2022-12-20T07:58:26.198146239Z"
}
Note: API key are very sensitive information and let anybody access your data if leaked, please take great care of it.
Find you organization ID
For most IoT API calls, you will need to know what's your organization ID. To find it out, please use api/v1/currentuser/organizations
SDK API endpoint :
curl -X 'GET' \
'https://api.sdk.nodle.io/api/v1/currentuser/organizations' \
-H 'accept: application/json' \
-H 'Authorization: Bearer {YOUR_TOKEN}'
[
{
"id": 123456,
"display_name": "Umbrella Corp.",
"data_addendum": true,
"verification_status": true,
"roles": [
"admin"
],
"created_on": "1968-07-22T09:57:17.497291Z",
"updated_on": "2022-08-15T14:58:51.627868Z"
}
]
Start using IoT API
With API key and organization ID in our hands, we are now able to use the IoT API :
curl -X 'GET' \
'https://iot.nodle.com/api/v1/organizations/{YOUR_ORGANIZATION_ID}' \
-H 'accept: application/json' \
-H 'x-api-key: {YOUR_API_KEY}'
{
"data": [
{
"bearer": null,
"enabled": false,
"id": "1e5677de-002e-4278-9b1c-909881b33962",
"identifier": "ibeacon:ace34cb9-d541-473e-8d77-a8e07a1df7dc",
"inserted_at": "2021-09-21T16:40:03",
"name": "Umbrella Corp. Fleet #1",
"organization_id": 123456,
"routing_target": null,
"routing_type": null,
"updated_at": "2022-11-21T18:41:17"
}
]
}
Token Issuance API
GET /v1/total-issuance
This API endpoint retrieves the total number of NODL tokens minted up until the time the API is called.
URL: api.nodle.com/v1/total-issuance
Method: GET
Auth required: No
Data Params: None
Success Response:
Code: 200 OK
Content: <number>
Sample Call:
curl -X GET <https://api.nodle.com/v1/total-issuance
>
Notes:
The total issuance number is dynamic and changes as new Nodle tokens are minted. The returned number is of type float with 1 NODL as its unit. Here is an example of the returned value: 8555296342.716467
.
This design for this API is solely for the convenience of third party coin market reporters such as coinmarketcap.
SubQL indexer API
The purpose of this documentation is to illustrate how to debug a GraphQL playground.
At present, we utilize services to index data from the chain. This helps to reduce load on the RPC nodes, resulting in a healthier network. It's important to note that this approach is only intended to support reads to the chain state. Starting from listing the projects we had you can go to:
https://managedservice.subquery.network/orgs/NodleCode/projects
Each project has its own playground, which provides an easy way to interact with the indexed data.
For more information, refer to this documentation: https://academy.subquery.network/run_publish/query.html
As stated in the document, we can use clients to send fast and reliable requests to the GraphQL service. Each client has its own documentation.
How to query the GraphQL without presets clients?
We need to start recognizing the entities created on the service. Here you will find the schema we have created for our main node:
https://github.com/NodleCode/subquery/blob/dddfb30a7772f895282ab19086bb2187b3679f76/schema.graphql
Based on the available information, we can construct our own queries and send them using curl.
Here, we use the entities generated based on the schema we shared earlier.
query {
accountPotBalances (first: 5) {
nodes {
id
potId
accountId
feeQuotaBalance
}
}
pots (first: 5) {
nodes {
id
potId
owner
feeQuotaBalance
}
}
}
Having the query already built, we can send it with curl like this way, where YOUR_GRAPHQL_ENDPOINT_URL
is the service url
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{ accountPotBalances (first: 5) { nodes { id potId accountId feeQuotaBalance } } pots (first: 5) { nodes { id potId owner feeQuotaBalance } } }" }' YOUR_GRAPHQL_ENDPOINT_URL
Treasury Allocations API
GET /v1/treasury-allocations/[date]
This API endpoint retrieves the total balance transferred to the Treasury account from allocations by a given day
URL: api.nodle.com/v1/treasury-allocations/[date]
Method: GET
Auth required: No
Data Params: This endpoint require a route param
[date]: The target date should be formatted as YYYY-MM-DD, for example, if the target date is 2022-09-20, the final URL should be api.nodle.com/v1/treasury-allocations/2022-09-20
.
Success Response:
Code: 200 OK
Content: <object>
Sample Call:
curl -X GET <api.nodle.com/v1/treasury-allocations/2022-09-20
>
Notes:
This endpoint is intended to help in accountant process.
Chain related REST APIs
Endpoints
/v1/transfers/:from/:to/:startDate/:endDate
/v1/transfers/:from/:to/:startDate/:endDate/csv
/v1/treasury-allocations/:date
/v1/treasury-allocations/:date/csv
/v1/total-issuance
/v1/circulating-supply
Authentication:
Not yet
GET transactions by accounts and date range
Endpoint: /v1/transfers/:from/:to/:startDate/:endDate
Parameters:
from
: The account ID from which to get transactions.to
: The account ID to which to get transactions.startDate
: The start date for the transaction history.endDate
: The end date for the transaction history.
Response:
{
"total-transferred-by-day": {
"2022-08-01": "10283.68663801",
"2022-08-02": "10283.50215288",
"2022-08-03": "10283.08764092",
"2022-08-04": "9025.79679093",
"2022-08-05": "11582.42033085",
"2022-08-06": "10283.01749122",
"2022-08-07": "10282.91112561",
"2022-08-08": "10282.86528657",
"2022-08-09": "10283.17438438",
"2022-08-10": "10283.10154094",
"2022-08-11": "10282.92408213",
"2022-08-12": "10282.31935558",
"2022-08-13": "10329.83817348",
"2022-08-14": "10283.16252236",
"2022-08-15": "10697.27183094"
}
}
GET transactions by accounts and date range in CSV
Endpoint:/v1/transfers/:from/:to/:startDate/:endDate/csv
Parameters:
from
: The account ID from which to get transactions.to
: The account ID to which to get transactions.startDate
: The start date for the transaction history.endDate
: The end date for the transaction history.
Response: A CSV file with the related data
GET treasury allocation
Endpoint:/v1/treasury-allocations/:date
Parameters:
date
: The date for which to get the treasury allocation.
Response:
{
"total-transferred": 10356.54827455
}
GET treasury allocation in CSV
Endpoint:/v1/treasury-allocations/:date/csv
Parameters:
date
: The date for which to get the treasury allocation
Response: A CSV file with the related data
GET Total issuance
Endpoint:/v1/total-issuance
Parameters:
None
Response:
A number, the total issuance of the token.
GET Circulating supply
Endpoint:/v1/circulating-supply
Parameters:
None
Response:
A number, the circulating supply of the token.
← Previous
Next →
On this page
- Introduction to Nodle APIs
- IoT API
- Getting started
- APIs
- SDK API authentication
- Create your API key
- Find you organization ID
- Start using IoT API
- Token Issuance API
- GET /v1/total-issuance
- SubQL indexer API
- Treasury Allocations API
- GET /v1/treasury-allocations/[date]
- Chain related REST APIs
- Endpoints
- GET transactions by accounts and date range
- GET transactions by accounts and date range in CSV
- GET treasury allocation
- GET treasury allocation in CSV
- GET Total issuance
- GET Circulating supply