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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.