Choosing Between REST and JSON-RPC

2025-12-08

Model comparison

REST is resource-centric, JSON-RPC is method-centric; they differ in semantics and routing.

REST example

GET /users/1
POST /users

JSON-RPC example

{
  "jsonrpc": "2.0",
  "method": "getUser",
  "params": { "id": 1 },
  "id": 1001
}

Versioning and evolution

REST commonly versions via path or headers; JSON-RPC evolves via method versions or parameters.

Error handling

REST leverages status codes and bodies; JSON-RPC uses standardized error objects. Both require stable error contracts.

Selection guidance

Choose based on team habits, ecosystem tools, and cross-platform debugging: favor REST for clear resource modeling; JSON-RPC for explicit remote-call semantics.