The Ardor API
The Ardor API allows interaction with Ardor nodes using HTTP requests to port 27876. Most HTTP requests can use either the GET or POST methods, but some API calls accept only the POST method for security reasons. Responses are returned as JSON objects.
Most Ardor API are similar to the corresponding NXT API described here here. Changes to existing NXT API are explained here Ardor migration page New Ardor API calls are documented below, with definitions given for HTTP request parameters and JSON response fields, followed by an example:
- The JSON response fields are each followed by one of S for string, A for array, O for object, N for number or B for boolean.
- In the examples, the Nxt node is represented as localhost and requests and responses are formatted for easy reading; line breaks and spaces are not actually used except in some parameter values. All requests are in URL format which implies the HTTP GET method. When GET is allowed, the URL can be entered into a browser URL field but proper URL encoding is usually required (e.g., spaces in a parameter value must be replaced by + or %20). Otherwise, the URL should be used as a guide to preparing an HTTP POST request using cURL, for example.
This document corresponds to Ardor version 2.0.10.
2 Coin Exchange Operations
2.1 Exchange Child Chain Coins
Exchange chain coin with another chain coin. This transaction is saved on the source chain unless the exchange chain is Ardor, in which case the transaction is stored on the Ardor chain.
- requestType is exchangeCoins
- chain is the source chain id
- exchange the target chain id
- quantityQNT is the quantity (in QNT) of the source chain coin
- priceNQTPerCoin is the exchange price (in whole units)
3 Transaction API
To get from a parent chain transaction to the child chain transactions it bundles.
- requestType is getFxtTransaction
- transaction is the 8 bytes transaction id
- fullHash is the 64 byte full hash id (either the transaction id or the full hash must be specified)
- requireBlock and requireLastBlock see below
Many APIs now support requireBlock and requireLastBlock optional parameters. If either of those is specified, it is guaranteed that the specified block is present in the blockchain, or the specified last block is the current last block, and the blockchain state does not change, while the API request is being executed. An error is returned otherwise.