Sends a request to a device and synchronously receives a response from the device.
If a device fails to send a response within the specified timeout period after you call the operation, IoT Platform considers that the call fails even if the device receives the message. The timeout period is specified by the Timeout parameter.
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | RRpc | The operation that you want to perform. Set the value to RRpc. |
| ProductKey | String | Yes | aldfeSe**** | The ProductKey of the product to which the device belongs. |
| DeviceName | String | Yes | device1 | The DeviceName of the device to which the request is sent. |
| RequestBase64Byte | String | Yes | dGhpcyBpcyBhbiBleGFtcGxl | The body of the message that you want to publish. To generate a message body, convert the raw message into binary data and perform Base64 encoding. Note IoT Platform decodes data by using the Base64 algorithm and then sends the decoded message to the device. This way, the device does not need to decode the Base64 encoded data. |
| Timeout | Integer | Yes | 1000 | The timeout period of a response. Unit: millisecond. Valid values: 1000 to 8000. |
| Topic | String | No | /a1uZfYb****/A_Vol****/user/update | The custom revert-RPC (RRPC) topic. Before you use a custom RRPC topic, you must configure the device. If you do not specify this parameter, the default RRPC topic is used. |
| ContentType | String | No | 240 | The type of the message that the server sends to the device over JT/T 808. Valid values: - 0: the data of global navigation satellite system (GNSS) modules. - 11: information about Integrated Circuit (IC) cards for road transportation permit cards. - 65: Serial Port 1 pass-through data. - 66: Serial Port 2 pass-through data. - 240 to 255: custom pass-through data. |
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common parameters.
| Parameter | Type | Example | Description |
|---|---|---|---|
| Code | String | iot.system.SystemException | The error code returned if the request failed. For more information, see the Error codes section of this topic. |
| ErrorMessage | String | A system exception occurred. | The error message returned if the request failed. |
| MessageId | Long | 889455942124347392 | The message ID that is generated by IoT Platform when the message is sent. |
| PayloadBase64Byte | String | d29ybGQgaGVsbG8= | The Base64-encoded payload that is returned by the device. |
| RequestId | String | 41C4265E-F05D-4E2E-AB09-E031F501AF7F | The request ID. |
| RrpcCode | String | SUCCESS | The response code returned if the request was successful. Valid values: - UNKNOWN: A system exception occurred. - SUCCESS: The request is successful. - TIMEOUT: The request times out. - OFFLINE: The device is offline. - HALFCONN: The device is offline but does not remain offline for a full heartbeat cycle. |
| Success | Boolean | true | Indicates whether the request was successful. Valid values: - true - false |
Sample requests
https://https://si-1cf342******782cd.tuyacloud.com:8686/?Action=RRpc
&ProductKey=aldfeSe****
&DeviceName=device1
&RequestBase64Byte=dGhpcyBpcyBhbiBleGFtcGxl
&Timeout=1000
&<Common request parameters>
Sample success responses
XML format
<?xml version='1.0' encoding='UTF-8'?>
<RRpcResponse>
<RequestId>41C4265E-F05D-4E2E-AB09-E031F501AF7F<RequestId/>
<Success>true</Success>
<RrpcCode>SUCCESS</RrpcCode>
<PayloadBase64Byte>d29ybGQgaGVsbG8=</PayloadBase64Byte>
<MessageId>889455942124347392</MessageId>
</RRpcResponse>
JSON format
{
"RrpcCode":"SUCCESS",
"PayloadBase64Byte":"d29ybGQgaGVsbG8=",
"MessageId":889455942124347392,
"RequestId":"41C4265E-F05D-4E2E-AB09-E031F501AF7F",
"Success":true
}