Queries rules by page.

Limits

Each Alibaba Cloud account can run a maximum of 20 queries per second (QPS).

Note 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 ListRule

The operation that you want to perform. Set the value to ListRule.

CurrentPage Integer Yes 1

The number of the page to return. Maximum value: 1000. Default value: 1.

PageSize Integer Yes 2

The number of entries to return on each page. Maximum value: 100. Default value: 10.

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

The ID of the instance. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased.

ResourceGroupId String No rg-acfmxazb4ph****

The ID of the resource group to which the rule belongs. You can view the resource group information in the Resource Management console.

If you do not specify this parameter, all resource groups of the Alibaba Cloud account are queried.

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 request parameters.

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

The error code returned if the call fails. For more information, see Error codes.

Data Array of RuleInfo

The list of rules returned if the call is successful. For more information, see RuleInfo.

Note The returned information is sorted in reverse-chronological order based on the time when the rules were created.
RuleInfo
CreateUserId Long 1231579085000000

The ID of the user who created the rule.

Created String Wed Feb 27 20:45:43 CST 2019

The time when the rule was created. The time is displayed in UTC-6.

DataType String JSON

The data type of the rule. Valid values: JSON and BINARY.

Id Long 151454

The ID of the rule.

Modified String Wed Feb 27 20:45:43 CST 2019

The time when the rule was last modified. The time is displayed in UTC-6.

Name String test123

The name of the rule.

ProductKey String a1KiV******

The ProductKey of the product to which the rule applies.

RuleDesc String rule1Desc

The description of the rule.

Select String deviceName() as deviceName

The SELECT clause in the SQL statement.

ShortTopic String +/thing/event/property/post

The topic to which the rule applies. The topic does not include the ProductKey level. Format: ${deviceName}/topicShortName. ${deviceName} indicates the name of the device, and topicShortName indicates the custom name of the topic.

Note For information about how to use the+or#wildcard in a topic, see Topic wildcards.
Status String STOP

The status of the rule. Valid values:

  • RUNNING: The rule is running.
  • STOP: The rule is disabled.
Topic String /a1T27vz****/+/thing/event/property/post

The topic to which the rule applies. Format:${productKey}/${deviceName}/topicShortName.

Note For information about how to use the+or#wildcard in a topic, see Topic wildcards.
UtcCreated String 2019-02-27T12:45:43.000Z

The time when the rule was last modified.

UtcModified String 2019-02-27T12:45:43.000Z

The time when the device was created. The time is displayed in UTC.

Where String Temperature>35

The WHERE clause in the SQL statement.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

Page Integer 1

The page number of the returned page.

PageSize Integer 2

The number of entries returned per page.

RequestId String 1564B626-DE97-452D-9E9B-305888AC6105

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.
Total Integer 25

The total number of returned pages.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=ListRule
&PageSize=2
&CurrentPage=1
&ResourceGroupId=rg-acfmxazb4ph****
&<Common request parameters>

Sample success responses

XML format

<ListRuleResponse>
  <Data>
        <RuleInfo>
              <DataType>JSON</DataType>
              <ProductKey>a1T27vz****</ProductKey>
              <CreateUserId>198426864326****</CreateUserId>
              <UtcModified>2020-02-26T06:38:27.000Z</UtcModified>
              <UtcCreated>2020-02-26T02:50:44.000Z</UtcCreated>
              <Where>Temperature&gt;35</Where>
              <Name>testrule2</Name>
              <Status>STOP</Status>
              <Select>deviceName() as DeviceName</Select>
              <Created>Wed Feb 26 10:50:44 CST 2020</Created>
              <Modified>Wed Feb 26 14:38:27 CST 2020</Modified>
              <Topic>/a1T27vz****/+/thing/event/property/post</Topic>
              <Id>497350</Id>
        </RuleInfo>
  </Data>
  <Page>1</Page>
  <PageSize>1</PageSize>
  <RequestId>1A6131EC-7504-4673-B997-DEFC6B363A37</RequestId>
  <Success>true</Success>
  <Total>5</Total>
</ListRuleResponse>

JSON format

{
    "Data": {
        "RuleInfo": [
            {
                "DataType": "JSON",
                "ProductKey": "a1T27vz****",
                "CreateUserId": "198426864326****",
                "UtcModified": "2020-02-26T06:38:27.000Z",
                "UtcCreated": "2020-02-26T02:50:44.000Z",
                "Where": "Temperature>35",
                "Name": "testrule2",
                "Status": "STOP",
                "Select": "deviceName() as DeviceName",
                "Created": "Wed Feb 26 10:50:44 CST 2020",
                "Modified": "Wed Feb 26 14:38:27 CST 2020",
                "Topic": "/a1T27vz****/+/thing/event/property/post",
                "Id": 497350
            }
        ]
    },
    "Page": 1,
    "PageSize": 1,
    "RequestId": "1A6131EC-7504-4673-B997-DEFC6B363A37",
    "Success": true,
    "Total": 5
}

Error codes

For a list of error codes, visit the API Error Center.