### Named Parameters RPC Call Source: https://www.jsonrpc.org/specification Demonstrates RPC calls using objects for named parameters. ```json --> {"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3} <-- {"jsonrpc": "2.0", "result": 19, "id": 3} --> {"jsonrpc": "2.0", "method": "subtract", "params": {"minuend": 42, "subtrahend": 23}, "id": 4} <-- {"jsonrpc": "2.0", "result": 19, "id": 4} ``` -------------------------------- ### Non-existent Method Error Source: https://www.jsonrpc.org/specification Demonstrates the error response when calling a method that does not exist. ```json --> {"jsonrpc": "2.0", "method": "foobar", "id": "1"} <-- {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "1"} ``` -------------------------------- ### Positional Parameters RPC Call Source: https://www.jsonrpc.org/specification Demonstrates standard RPC calls using arrays for positional parameters. ```json --> {"jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1} <-- {"jsonrpc": "2.0", "result": 19, "id": 1} --> {"jsonrpc": "2.0", "method": "subtract", "params": [23, 42], "id": 2} <-- {"jsonrpc": "2.0", "result": -19, "id": 2} ``` -------------------------------- ### Empty Batch Request Source: https://www.jsonrpc.org/specification Demonstrates the error response when an empty array is sent as a batch request. ```json --> [] <-- {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null} ``` -------------------------------- ### Batch Notification Request Source: https://www.jsonrpc.org/specification Demonstrates a batch request consisting entirely of notifications, which returns no response. ```json --> [ {"jsonrpc": "2.0", "method": "notify_sum", "params": [1,2,4]}, {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]} ] <-- //Nothing is returned for all notification batches ``` -------------------------------- ### Batch Request Processing Source: https://www.jsonrpc.org/specification Demonstrates a batch request containing multiple valid and invalid calls. ```json --> [ {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"}, {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]}, {"jsonrpc": "2.0", "method": "subtract", "params": [42,23], "id": "2"}, {"foo": "boo"}, {"jsonrpc": "2.0", "method": "foo.get", "params": {"name": "myself"}, "id": "5"}, {"jsonrpc": "2.0", "method": "get_data", "id": "9"} ] <-- [ {"jsonrpc": "2.0", "result": 7, "id": "1"}, {"jsonrpc": "2.0", "result": 19, "id": "2"}, {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}, {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "5"}, {"jsonrpc": "2.0", "result": ["hello", 5], "id": "9"} ] ``` -------------------------------- ### JSON-RPC Syntax Legend Source: https://www.jsonrpc.org/specification Defines the notation used for data transmission between client and server. ```text --> data sent to Server <-- data sent to Client ``` -------------------------------- ### Notification RPC Call Source: https://www.jsonrpc.org/specification Demonstrates notification calls which do not expect a response. ```json --> {"jsonrpc": "2.0", "method": "update", "params": [1,2,3,4,5]} --> {"jsonrpc": "2.0", "method": "foobar"} ``` -------------------------------- ### Invalid JSON Error Source: https://www.jsonrpc.org/specification Demonstrates the error response when the request contains invalid JSON syntax. ```json --> {"jsonrpc": "2.0", "method": "foobar, "params": "bar", "baz] <-- {"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null} ``` -------------------------------- ### Invalid Request Object Error Source: https://www.jsonrpc.org/specification Demonstrates the error response when the request object is malformed. ```json --> {"jsonrpc": "2.0", "method": 1, "params": "bar"} <-- {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null} ``` -------------------------------- ### Invalid Batch Request Source: https://www.jsonrpc.org/specification Demonstrates the error response when a batch request contains invalid elements. ```json --> [1] <-- [ {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null} ] ``` ```json --> [1,2,3] <-- [ {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}, {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}, {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null} ] ``` -------------------------------- ### Batch Request Invalid JSON Source: https://www.jsonrpc.org/specification Demonstrates the error response when a batch request contains invalid JSON. ```json --> [ {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"}, {"jsonrpc": "2.0", "method" ] <-- {"jsonrpc": "2.0", "error": {"code": -32700, "message": "Parse error"}, "id": null} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.