Queries detailed information about a specified rule.
Limits
Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetRule |
The operation that you want to perform. Set the value to GetRule. |
RuleId | Long | Yes | 100000 |
The ID of the rule that you want to query. You can log on to the IoT Platform console and choose Rules > Data Forwarding to view the rule ID. You can also call the ListRule operation and view the rule ID in the response. |
IotInstanceId | String | No | iot-cn-0pp1n8t**** |
The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console. Notice
For more information, see Overview. |
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. |
ErrorMessage | String | A system exception occurred. |
The error message returned if the call fails. |
RequestId | String | 58D4CEC0-3E95-4DBE-AFC1-809D1400E52F |
The ID of the request. |
RuleInfo | Struct |
The rule information returned if the call is successful. For more information, see RuleInfo. |
|
CreateUserId | Long | 100000000000000 |
The ID of the user who created the rule. |
Created | String | Thu Feb 28 14:14:33 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 | 100000 |
The ID of the rule. |
Modified | String | Thu Feb 28 14:20:58 CST 2019 |
The time when the rule was last modified. The time is displayed in UTC-6. |
Name | String | iotrules |
The name of the rule. |
ProductKey | String | a1KiV****** |
The ProductKey of the product to which the rule applies. |
RuleDesc | String | rule1Desc |
The description of this rule. |
Select | String | deviceName() as deviceName |
The values of Select in the SQL statements of the rule. |
ShortTopic | String | +/user/pm25data |
The topic to which the rule applies. The topic does not include the ProductKey level.
Format: |
Status | String | STOP |
The status of the rule. Valid values:
|
Topic | String | /a1QsMlL44pp/+/user/pm25data |
The complete topic to which the rule applies. Format: |
TopicType | Integer | 1 |
The type of the topic. This parameter is returned if you set the SQL statement for the rule. Valid values:
If no SQL statement is set for the rule, the value -1 is returned. |
UtcCreated | String | 2019-02-28T06:14:33.000Z |
The time when the rule was created. The time is displayed in UTC. |
UtcModified | String | 2019-02-28T06:20:58.000Z |
The time when the rule was last modified. The time is displayed in UTC. |
Where | String | Temperature>35 |
The Where query condition in the SQL statements of the rule. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=GetRule
&RuleId=100000
&<Common request parameters>
Sample success responses
XML
format
<GetRuleResponse>
<RequestId>85648524-E5EE-418E-BD16-FAFBB4FF3645</RequestId>
<Success>true</Success>
<RuleInfo>
<DataType>JSON</DataType>
<ShortTopic>+/user/pm25data</ShortTopic>
<ProductKey>a1QsMl****</ProductKey>
<UtcModified>2019-12-23T03:34:45.000Z</UtcModified>
<CreateUserId>198426864326****</CreateUserId>
<UtcCreated>2019-12-23T02:32:06.000Z</UtcCreated>
<Name>Ruff_rule1</Name>
<Status>RUNNING</Status>
<Select>deviceName() as deviceName , timestamp('yyyy-MM-dd HH:mm:ss') as time, pm25, pm10</Select>
<Created>Mon Dec 23 10:32:06 CST 2019</Created>
<Modified>Mon Dec 23 11:34:45 CST 2019</Modified>
<TopicType>1</TopicType>
<Topic>/a1QsMlL****/+/user/pm25data</Topic>
<Id>425367</Id>
</RuleInfo>
</GetRuleResponse>
JSON
format
{
"RequestId": "85648524-E5EE-418E-BD16-FAFBB4FF3645",
"Success": true,
"RuleInfo": {
"DataType": "JSON",
"ShortTopic": "+/user/pm25data",
"ProductKey": "a1QsMl****",
"UtcModified": "2019-12-23T03:34:45.000Z",
"CreateUserId": "198426864326****",
"UtcCreated": "2019-12-23T02:32:06.000Z",
"Name": "Ruff_rule1",
"Status": "RUNNING",
"Select": "deviceName() as deviceName , timestamp('yyyy-MM-dd HH:mm:ss') as time, pm25, pm10",
"Created": "Mon Dec 23 10:32:06 CST 2019",
"Modified": "Mon Dec 23 11:34:45 CST 2019",
"TopicType": 1,
"Topic": "/a1QsMlL****/+/user/pm25data",
"Id": 425367
}
}
Error codes
For a list of error codes, visit the API Error Center.