API Call Structure

The descriptions of the API calls contain JSON-RPC requests / responses as you would see them on the wire.

JSON-RPC request object

JSON-RPC is a stateless, light-weight remote procedure call (RPC) protocol. A JSON-RPC is represented by sending a Request object. The Request object has the following members:

jsonrpc

A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

id

An identifier established by the Client that MUST contain a String, Number, or NULL value if included. If it is not included it is assumed to be a notification.

method

A String containing the name of the method to be invoked.

params

A Structured value that holds the parameter values to be used during the invocation of the method. This is not required for every method

Grouping this all together will give the complete JSON-RPC request:

Copy
{
    "jsonrpc": "version",
    "id": 0,
    "method": "method-name",
    "params": [
        "structured-params"
    ]
}

JSON-RPC response object

When a rpc call is made, there will be a Response, except for in the case of Notifications. The Response is expressed as a single JSON Object, with the following members:

jsonrpc

A String specifying the version of the JSON-RPC protocol. MUST be exactly "2.0".

id

This member is the same as the value of the id member in the Request Object.

result

The value of this member is determined by the method in the Request object.

error

This member is returned only on error.

Grouping this all together will give the complete JSON-RPC response:

Copy
{
    "jsonrpc": "version",
    "id": 0,
    "result": "method-result"
}