Skip to main content

RPC

Remote Procedure Call (RPC) Service definitions over CoAP.

How to use guides:

Interface

MethodDescriptionPathContent Format
GET/ObserveListen for RPCs sent to a device./.rpcJSON/CBOR
POSTReport RPC status and return data./.rpc/statusJSON/CBOR

RPC Parameters and attributes:

Here is an example of an RPC payload sent to a device by the Golioth server:

{
"id": "multiply/74e4",
"method": "multiply",
"params": [ 7, 191 ]
}
AttributeDescription
idString representation of a unique id assigned by the server.
methodString indicating the function name called.
paramsArray of input parameters to pass to method.

The params may be empty, or contain any combination of values in the following formats:

  • boolean
  • float
  • integer
  • string

RPC Status Parameters and attributes:

The device returns a payload to the Golioth server that includes the status of the RPC and any data returned by the function:

{
"id": "multiply/74e4",
"status": 0,
"detail": {
"value": 1337
}
}
AttributeDescription
idString representation of the unique id received from the server.
statusInteger indicating the outcome of the RPC.
detailArray of output parameters.
  • For a full list of status codes, please see the golioth_rpc_status enum on the Golioth Firmware SDK doxygen reference.

  • The detail object may be empty, or contain any combination of key/value pairs in the following formats:

    • boolean
    • float
    • integer
    • string