Skip to main content

Example 8. JSON-RPC 2.0

JSight API 0.3OpenRPC 1.2.1
JSIGHT 0.3

URL /
Protocol json-rpc-2.0
Method listPets // List all pets
Params
[
20 // Limit (how many items to return).
]
Result
[ // An array of pets
{ // Pet
"id": 123,
"name": "Tom"
}
]

The JSON-RPC API is as simple to describe as the REST API.

More about JSON-RPC 2.0 support: Quick Tutorial. Lesson 10. JSON-RPC 2.0 support.

Star us on GitHub — it motivates us a lot!

{
"openrpc": "1.2.1",
"info": {
"version": "",
"title": ""
},
"methods": [
{
"name": "listPets",
"description": "List all pets",
"params": [
{
"name": "limit",
"description": "How many items to return",
"schema": {
"type": "integer"
}
}
],
"result": {
"name": "pets",
"description": "An array of pets",
"schema": {
"type": "array",
"items": {
"title": "Pet",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}
}
},
"examples": [
{
"name": "listPetExample",
"description": "List pet example",
"params": [
{
"name": "limit",
"value": 20
}
],
"result": {
"name": "listPetResultExample",
"value": [
{
"id": 123,
"name": "Tom"
}
]
}
}
]
}
]
}