Server Reference Guide : JSON-RPC 2.0 Interface : Sending JSON-RPC Requests to the Server Application
 
Share this page          
Sending JSON-RPC Requests to the Server Application
There are two ways to send JSON-RPC requests to the server application. Both use a dedicated URL served by the Java-based OpenROADJSONRPC servlet:
Sending an HTTP POST request containing the JSON-RPC request
Calling the JsonRpcRequest() method of the RemoteServer class
The actual 4GL procedure called is specified by the “method” member of the JSON-RPC request object. The parameters to be passed are specified by the “params” member.
The following is an example of a JSON-RPC request to call a 4GL procedure “subtract” (with parameters “minuend” and “subtrahend” of decimal or float type, returning the result of minuend-subtrahend):
{"jsonrpc":"2.0", "id":2, "method":"subtract",
        "params":{"subtrahend":23.4, "minuend":42.8}}
This results in a JSON-RPC response like this:
{"result":19.4, "id":2, "jsonrpc":"2.0"}