Description
Is your feature request related to a problem? Please describe.
In our organization, we have many JSON-RPC 2.0 over HTTP API's. We use Postman to share collection to improve development speed. Recetly GraphQL was added as HTTP body type which made me wish JSON-RPC would be added as body type too.
Describe the solution you'd like
Next to form-data
, raw
, binary
and GraphQL
we would like to see JSON-RPC 2.0
support. If that is added together with code generation examples it would improve our documentation a lot.
Describe alternatives you've considered
Currently, we use the raw body as:
{
"jsonrpc": "2.0",
"id": 1,
"method": "reverse",
"params": {
"parameter_one": "hello_world"
}
}
This works, only it does not generate smart documentation which are using JSON-RPC libraries. Also, it makes the documentation harder to understand.
Additional context
I can make code templates for: Python, Java and PHP.
Asume request:
POST https://domain.com/api/v1
{
"jsonrpc": "2.0",
"id": 1,
"method": "reverse",
"params": {
"parameter_one": "hello_world"
}
}
Python3 example:
from tinyrpc.protocols.jsonrpc import JSONRPCProtocol
from tinyrpc.transports.http import HttpPostClientTransport
from tinyrpc import RPCClient
rpc_client = RPCClient(
JSONRPCProtocol(),
HttpPostClientTransport('https://domain.com/api/v1'))
apiv1 = rpc_client.get_proxy()
apiv1.reverse('hello_world')