Simple RPC style APIs with generated clients & servers.
All RPC methods are invoked with the POST method, and the RPC method name is placed in the URL path. Input is passed as a JSON object in the body, following a JSON response for the output as shown here:
$ curl -d '{ "project_id": "ping_production" }' https://api.example.com/get_alerts
{
"alerts": [...]
}
All inputs are objects, all outputs are objects, this improves future-proofing as additional fields can be added without breaking existing clients. This is similar to the approach AWS takes with their APIs.
There are several commands provided for generating clients, servers, and documentation. Each of these commands accept a -schema
flag defaulting to schema.json
, see the -h
help output for additional usage details.
rpc-dotnet-client
generates .NET clientsrpc-ruby-client
generates Ruby clientsrpc-php-client
generates PHP clientsrpc-elm-client
generates Elm clientsrpc-go-client
generates Go clientsrpc-go-types
generates Go type definitionsrpc-ts-client
generates TypeScript clients
rpc-go-server
generates Go servers
rpc-md-docs
generates markdown documentation
Currently the schemas are loosely a superset of JSON Schema, however, this is a work in progress. See the example schema.