All Products
Search
Document Center

IoT Platform:RRpc

最終更新日:Oct 20, 2023

Sends a request to a device and synchronously receives a response from the device.

Usage notes

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.

QPS limits

You can call this operation up to 1,000 times per second per account.

Note

The Resource Access Management (RAM) users of an Alibaba Cloud account share the quota of the account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

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.

IotInstanceId String No iot_instc_pu****_c*-v64********

The instance ID. You can view the ID of the instance on the Overview page in the IoT Platform console.

Important

  • If your instance has an ID, you must specify the ID for this parameter. Otherwise, the call fails.
  • If the Overview page is not displayed or your instance does not have an ID, you do not need to specify this parameter.

For more information, see Overview.

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. For more information, see Use custom topics. 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.

For more information about how to use JT/T 808 supported by IoT Platform, see JT/T 808 gateways.

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.

Response 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

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?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
}

Error codes

For a list of error codes, see Service error codes.