Legrand / Raritan Xerus™ JSON-RPC API for Remote Access Devices like KX4-101, KX3G2

Loading...
Searching...
No Matches
Curl JSON-RPC Example

# Mechanism

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 Xerus™ 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 Well-Known Resource IDs.

# Examples

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 KVM security settings:

Code:

curl -skd '{ "jsonrpc": "2.0", "method": "getSecuritySettings", "id": 42 }' \
https://my_user:my_pass@my-xerus.example.com/radm/kvmmanager

Note
  Replace `my_user:my_pass` with Default Credentials of your product, or your own credentials.

Result:

{
"jsonrpc": "2.0",
"result": {
"_ret_": {
"pcShare": false,
"pcShareIdleTimeout": 5,
"vmShare": false,
"kvmEncryption": true,
"disableLocalPortOutput": false,
"controlPriority": 0,
"resetPinMode": 0,
"sshDpa": false,
"urlDpa": false,
"allowIFrame": false
}
},
"id": 42
}