XRP — server, Methods, mpt (3/3)
API reference for XRP. All methods ->
version
Retrieves API version information.
The version command retrieves the API version information of the Clio server. For rippled servers, see version (rippled) instead.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON-RPC spec used (example: 2.0).method(string; required): a method used for the request.params(array; required): none.
Returns
The response follows the standard format, with a successful result containing an info object as its only field.
The version object returns some arrangement of the following fields:
first(integer): Lowest supported API release.last(integer): Highest supported API release.good(integer): Default API if none specified.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "version",
"params": []
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"status": "success",
"version": {
"first": "1.0.0",
"good": "1.0.0",
"last": "1.0.0"
}
}
}
Utility Methods:
Use these methods to perform convenient tasks, such as ping and random number generation.
ping
Confirms connectivity with the server.
The ping command returns an acknowledgement, so that clients can test the connection status and latency.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON-RPC spec used (example: 2.0).method(string; required): a method used for the request.params(array; required): none.
Returns
The response follows the standard format, with a successful result containing no fields. The client can measure the round-trip time from request to response as latency.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "ping",
"params": []
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"status": "success"
}
}
random
Generates a random number.
The random command provides a random number to be used as a source of entropy for random number generation by clients.
Parameters
id(integer; required): a request ID (example: 1).jsonrpc(string; required): a JSON-RPC spec used (example: 2.0).method(string; required): a method used for the request.params(array; required): none.
Returns
The response follows the standard format, with a successful result containing the following field:
random(string): Random 256-bit hex value.
Request example
curl 'https://rpc.ankr.com/xrp_mainnet/YOUR_ANKR_API_KEY' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "random",
"params": []
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"random": "3060417EAEBDB220E2CBED2B4BCBAEDD805D8A1A8D7C405A868F11ABB7249B2A",
"status": "success"
}
}