latestOpenAPI 3.1.0Apache License Version 2.02026-08-17498525913.3 KB

40169ccdec5c

rpc-v-2-controller

Send two-way RPC request

Sends the two-way remote-procedure call (RPC) request to device. Sends the one-way remote-procedure call (RPC) request to device. The RPC call is A JSON that contains the method name ('method'), parameters ('params') and multiple optional fields. See example below. We will review the properties of the RPC call one-by-one below.

{
  "method": "setGpio",
  "params": {
    "pin": 7,
    "value": 1
  },
  "persistent": false,
  "timeout": 5000
}

Server-side RPC structure

The body of server-side RPC request consists of multiple fields:

  • method - mandatory, name of the method to distinct the RPC calls. For example, "getCurrentTime" or "getWeatherForecast". The value of the parameter is a string.
  • params - mandatory, parameters used for processing of the request. The value is a JSON. Leave empty JSON "{}" if no parameters needed.
  • timeout - optional, value of the processing timeout in milliseconds. The default value is 10000 (10 seconds). The minimum value is 5000 (5 seconds).
  • expirationTime - optional, value of the epoch time (in milliseconds, UTC timezone). Overrides timeout if present.
  • persistent - optional, indicates persistent RPC. The default value is "false".
  • retries - optional, defines how many times persistent RPC will be re-sent in case of failures on the network and/or device side.
  • additionalInfo - optional, defines metadata for the persistent RPC that will be added to the persistent RPC events.

RPC Result

In case of persistent RPC, the result of this call is 'rpcId' UUID. In case of lightweight RPC, the result of this call is the response from device, or 504 Gateway Timeout if device is offline.

Available for users with 'TENANT_ADMIN' or 'CUSTOMER_USER' authority.

post/api/rpc/twoway/{deviceId}

Path parameters

deviceIdstring required

A string value representing the device id. For example, '784f394c-42b6-435a-983c-b7beff2784f9'

Request body

string required

A JSON value representing the RPC request.

Response

Persistent RPC request was saved to the database or lightweight RPC response received.

string required