Racom RPC
General rules:
- Attribute values must never contain any of the
"'\;$characters. - Authentication/authorization is not part of this spec, it must be handled on another level.
Request
| attribute | description |
|---|---|
method* string |
The name of the method to be called. |
paramsobject |
The value to be passed as parameter to the method. |
targetstring |
IP address of remote device to whom device redirects a request. If target is not set, request is not redirected to remote device and it is consumed by original device. |
🌄 idstring |
Id used for pairing requests to response if this is not provided implicitly by the underlying protocol. |
🌄 version string |
Specifies the versions of the protocol. |
Example
{
"method": "get_user_detail",
"params": { "username": "adam" },
"target": "10.10.10.170",
"language-code": "en"
}
Response
There are two response formats: the standard response format and the root
response format.
Common attributes
Both JSON responses share the following common attributes:
| attribute | description |
|---|---|
errorError |
Error caused by invoking the given method (not exclusive with result, base64 or any other attributes) |
warnings[Warning] |
Warnings caused by invoking the given method |
deviceDevice |
Miscellaneous information about the device |
🌄 idstring |
ID used for pairing requests to response if this is not provided implicitly by the underlying protocol |
🌄 version string |
The protocol version |
Device
| attribute | description |
|---|---|
tstampunsigned int |
The Unix timestamp of the current time of the device |
Standard response format
Used when the response is a JSON object.
On top of the common attributes, it also contains:
| attribute | description |
|---|---|
resultobject |
The data returned by the invoked method |
Example
{
"result": {
"username": "adam",
"age": 27,
"name": "Adam"
},
"error": {
"code": "rpc_server_error",
"message_id": "hw_failure_detected"
},
"warnings": [
{
"code": "incomplete_data",
"message_id": "incomplete_data_returned"
}
],
"device": { "tstamp": 1588757876 }
}
Root response format
Typically used when the response is a base64 encoded file.
The response is not wrapped in the result attribute, but instead returned in
the root of the response JSON alongside the common attributes.
Example
{
"base64": "YWJjCg==",
"error": {
"code": "rpc_server_error",
"message_id": "hw_failure_detected"
},
"warnings": [
{
"code": "incomplete_data",
"message_id": "incomplete_data_returned"
}
],
"device": { "tstamp": 1588757876 }
}