JSON RPC 2.0 API

This section describes the communication protocol between the control system and the 4140PWRR3 using RPC calls using the JSON-RPC 2.0 protocol

Definitions

Caution

Commands must be formatted as defined in the JSON-RPC 2.0 protocol
All commands sent over TCP transport must end with <LF>
All replies are formatted as defined in the JSON-RPC 2.0 protocol
All replies over TCP transport end up with <LF>
<LF> stands for “line feed”, corresponding hex is 0x0A

Transport protocols

JSON-RPC 2.0 commands can flow over different transport protocols, they need to be enabled in the config file of the installed api service. Per default they might not be enabled.

Transport Config Datatype Example Supported Versions
TCP jrpc2TCPInterface string eth1 >v1.0.1
TCP jrpc2TCPPort int 64823 >v1.0.1
TCP jrpc2HTTPInterface string eth1 >v1.0.1
TCP jrpc2HTTPPort int 64880 >v1.0.1

In subsequent pages all methods are described that can be used.

Concurrency

All JSON-RPC 2.0 services do support asynchronous message processing. 3rd party control Systems must keep tracking of the id’s to determine whether a request was successful or not

TCP transport

Any TCP capable application can be used to test commands. Do not forget to end up with <LF>

HTTP transport

The body of the HTTP POST request must contain the complete JSON-RPC request message, encoded with Content-Type: application/json. Either a single request object or a list of request objects is supported. If the request completes, whether or not there is an error, the HTTP response is 200 (OK) for ordinary requests or 204 (No Response) for notifications, and the response body contains the JSON-RPC response. If the HTTP request method is not “POST”, 4140PWRR3 reports 405 (Method Not Allowed). If the Content-Type is not application/json, 4140PWRR3 reports 415 (Unsupported Media Type).

Test from a linux shell:
curl -i -X POST -H ‘Content-Type: application/json’ -d ‘{“jsonrpc”:“2.0”,“id”:1,“method”:“rpc.serverInfo”}’ http://host:64880