8

I'm reading the JSON RPC API documentation but I cannot understand what is the id that should be specified in the request (and that is also returned in the answer).

Is this simply a nonce that indicates that the given reply corresponds to a given request?

2 Answers 2

8

It is part of the JSON RPC specs:

http://www.jsonrpc.org/specification

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. The value SHOULD normally not be Null [1] and Numbers SHOULD NOT contain fractional parts [2]

It's basically an identifier for your client to know which response corresponds to which request - in case you're using something like a WebSocket endpoint, where you're getting a stream of replies instead of just one reply per request like HTTP POST.

1

Yes. Depending on how your application communicates with the API/node, this may help you to match queries to responses.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.