Server Reference Guide : JSON-RPC 2.0 Interface : JSON-RPC Batch Requests
 
Share this page          
JSON-RPC Batch Requests
It is possible to pass a batch of requests to the server with one JSON-RPC request. In this case the JSON-RPC request is a JSON array containing request objects.
The response will contain an array of response objects—one for each request object, which is not a notification request.
If there is some problem with a JSON-RPC request such as:
[
  {"jsonrpc": "2.0", "method": "subtract",
    "params": {"subtrahend": 23, "minuend": 42}, "id": 1},
  {"jsonrpc": "2.0", "method": "xyz"},
  {"jsonrpc": "2.0", "method": "dummy", "id": 2},
  {"jsonrpc": "2.0", "method": "subtract",
    "params": {"minuend": 3, "subtrahend": 1}, "id": 3}
]
you will get a JSON-RPC response with an error instead of a result, as:
[
  {"jsonrpc": "2.0", "result": 19, "id": 1},
  {"jsonrpc": "2.0", 
    "error": {"code": -32601, "message": "Method not found"}, "id": 2},
  {"jsonrpc": "2.0", "result": 2, "id": 3}
]
Note:  There is no response for the second request in the batch because it is a notification request.