Curl JSON-RPC Example


Curl is a cross-platform command line tool for getting or sending files using URL syntax. The tool can be used for sending out HTTP POST requests to invoke JSON-RPC methods on a Raritan device. The response document is printed on the standard output of Curl. This is a direct way to check out particular objects and their methods.

Authentication credentials must be provided using options of curl or as part of the URL.

In case HTTPS is used as protocol and the certificate installed on the device cannot be validated curl must be instructed to allow insecure connections using the '-k' option.

In order to direct the request to the desired object implementing a particular interface a well-known resource identfier must be used as part of the URL. All well know URIs are defined in file Well-Known-URIs.txt. Note that the link points to a file which is specific for one product, EMX or PX.


Note: The output of the examples below has been formatted for readability. JSON objects can be pretty-printed by filtering them through tools like indent or python -mjson.tool.

Getting device information:


curl -skd '{ "jsonrpc": "2.0", "method": "getMetaData", "id": 23 }' \


"jsonrpc": "2.0",
"result": {
"_ret_": {
"nameplate": {
"manufacturer": "Raritan",
"model": "EMX2-888-v0",
"partNumber": "emx2-888",
"serialNumber": "PH81234567",
"rating": {
"voltage": "100-240V",
"current": "0.7A",
"frequency": "50/60Hz",
"ctrlBoardSerial": "PNW1691120",
"hwRevision": "0x01",
"fwRevision": "",
"id": 23