All Products
Search
Document Center

IoT Platform:ListRule

Last Updated:Sep 15, 2023

Queries rules by page.

QPS limits

You can call this API operation up to 20 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

ListRule

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

CurrentPage

Integer

Yes

1

The page number. Maximum value: 1000. Default value: 1.

PageSize

Integer

Yes

2

The number of entries per page. Valid values: 1 to 100. Default value: 10.

IotInstanceId

String

No

iot_instc_pu****_c*-v64********

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

Important
  • If the instance has an ID, you must specify this parameter. If you do not specify this parameter, the request fails.

  • If the Overview tab or instance ID is not displayed in the IoT Platform console, you do not need to specify this parameter.

For more information about instances, see Overview.

ResourceGroupId

String

No

rg-acfmxazb4ph****

The resource group ID.

Important

IoT Platform supports resource group management only by instance. The ResourceGroupId parameter is invalid. You do not need to specify this parameter.

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 Error codes.

Data

Array of RuleInfo

The rules returned if the request was successful. For more information, see the description of the RuleInfo parameter in this topic.

Note

The returned rules are sorted in descending 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 rule ID.

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 content in the SELECT clause in the SQL statement of the rule.

ShortTopic

String

+/thing/event/property/post

The name of the topic to which the rule applies, excluding the ProductKey. The value is in the format of ${deviceName}/topicShortName. ${deviceName} indicates the name of the device, and topicShortName indicates the custom name of the topic.

Note

The topic name may contain the + or # wildcard character. For more information, see Topics.

Status

String

STOP

The state of the rule. Valid values:

  • RUNNING: The rule is running.

  • STOP: The rule is stopped.

Topic

String

/a1T27vz****/+/thing/event/property/post

The name of the topic to which the rule applies, including the ProductKey. The value is in the format of ${productKey}/${deviceName}/topicShortName.

Note

The topic name may contain the + or # wildcard character. For more information, see Topics.

UtcCreated

String

2019-02-27T12:40:43.000Z

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

UtcModified

String

2019-02-27T12:45:43.000Z

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

Where

String

Temperature>35

The condition in the WHERE clause in the SQL statement of the rule.

ErrorMessage

String

A system exception occurred.

The error message returned if the request failed.

Page

Integer

1

The page number.

PageSize

Integer

2

The number of entries per page.

RequestId

String

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

The request ID.

Success

Boolean

true

Indicates whether the request was successful. Valid values:

  • true

  • false

Total

Integer

25

The total number of pages returned.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=ListRule
&PageSize=2
&CurrentPage=1
&<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, see Service error codes.