JSONRPC request with curl JSONRPC request with curl json json

JSONRPC request with curl


The specific error you're receiving ("Invalid parameters") does indicate your parameter type may be wrong for the specific method you're invoking, but for anyone looking for general guidance for making JSON-RPC calls with curl, that may not be the issue.

For JSON-RPC 2.0 the spec requires passing a string specifying the protocol version, "jsonrpc": "2.0", which is missing in the question's example.

Here's an example of a compliant, working call (tested with a jayson server):

curl -X POST \     -H 'Content-Type: application/json' \     -d '{"jsonrpc":"2.0","id":"id","method":"add","params":[1, 2]}' \     http://localhost:3000


Try removing the array brackets [] from around the object brackets in your second attempt.

like:

curl -d '{"id":"json","method":"add","params":{"a":2,"b":3} }' -o – [http address for json rpc]