Query the Rule Triggering Condition List
Function
This API is used by an application to query the rule triggering condition list on the IoT platform.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v5/iot/{project_id}/routing-rule/rules
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resource |
No |
String |
Parameter description: subscribed resource name. Options:
|
event |
No |
String |
Parameter description: subscribed event. Value: The value range varies by resource type. event must be associated with resource. The mapping between event and resource is as follows:
|
app_type |
No |
String |
Parameter description: application scope of the tenant rule. Options:
|
app_id |
No |
String |
Parameter description: resource space ID. This parameter is optional. If app_id is specified, the rule actions in the specified resource space are queried. If app_id is not specified, the rule actions in the default resource space are queried. Value: The value can contain a maximum of 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
rule_name |
No |
String |
Parameter description: custom rule name. |
active |
No |
Boolean |
Parameter description: whether the rule triggering condition is activated. |
limit |
No |
Integer |
Parameter description: number of records to display on each page. By default, 10 records are displayed on each page. A maximum of 50 records can be displayed on each page. Value: The value is an integer ranging from 1 to 50. The default value is 10. |
marker |
No |
String |
Parameter description: ID of the last record in the previous query. The value is returned by the platform during the previous query. Records are queried in descending order of record IDs (the marker value). A newer record will have a larger ID. If marker is specified, only the records whose IDs are smaller than marker are queried. If marker is not specified, the query starts from the record with the largest ID, that is, the latest record. If all data needs to be queried in sequence, this parameter must be filled with the value of marker returned in the last query response each time. Value: The value is a string of 24 hexadecimal characters. The default value is ffffffffffffffffffffffff. |
offset |
No |
Integer |
Parameter description: If offset is set to N, the query starts from the N+1 record after the last record in the previous query. The value is an integer ranging from 0 to 500. The default value is 0. If offset is set to 0, the output starts from the first record after the last record in the previous query. - To ensure API performance, you can use this parameter together with marker to turn pages. For example, if there are 50 records on each page, you can directly specify offset to jump to the specified page within page 1 and 11. If you want to view records displayed on pages 12 to 22, you need to use the marker value returned on page 11 as the marker value for the next query. Value: The value is an integer ranging from 0 to 500. The default value is 0. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Parameter description: user token. You can obtain the token by calling the IAM API Obtaining a User Token Through Password Authentication. X-Subject-Token in the response header returned by the API is the desired user token. For details about how to obtain the token, see Token Authentication. |
Instance-Id |
No |
String |
Parameter description: instance ID. This parameter is required only when the API is called from the management plane in the physical multi-tenant scenario. You can log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
rules |
Array of RoutingRule objects |
List of rule triggering conditions. |
count |
Integer |
Total number of records that meet the query conditions. |
marker |
String |
ID of the last record in this query, which can be used in the next query. |
Parameter |
Type |
Description |
---|---|---|
rule_id |
String |
Unique ID of a rule triggering condition. The value is allocated by the platform during rule triggering condition creation. |
rule_name |
String |
Custom rule name. |
description |
String |
Custom rule description. |
subject |
RoutingRuleSubject object |
Resource change event. |
app_type |
String |
Application scope of the tenant rule. Options:
|
app_id |
String |
Resource space ID. |
select |
String |
Custom SQL select statement. The value can contain up to 2500 characters. This parameter is used only by users of the Standard and Enterprise editions. |
where |
String |
Custom SQL where statement. The value can contain up to 2500 characters. This parameter is used only by users of the Standard and Enterprise editions. |
active |
Boolean |
Whether the rule triggering condition is activated. |
Parameter |
Type |
Description |
---|---|---|
resource |
String |
Parameter description: resource name. Options:
|
event |
String |
Parameter description: resource event. Value: The value range varies by resource type. event must be associated with resource. The mapping between event and resource is as follows:
|
Example Requests
Queries data forwarding rules in a list.
GET https://{endpoint}/v5/iot/{project_id}/routing-rule/rules
Example Responses
Status code: 200
Successful response
{ "rules" : [ { "rule_id" : "5bcaddda-75bf-4623-8c8d-26175c41fcca", "app_type" : "GLOBAL", "select" : "*", "rule_name" : "rulename", "subject" : { "resource" : "device", "event" : "create" }, "description" : "description", "active" : true, "where" : "product_id='d89c-44dd-8265-b1653d951ce0'", "app_id" : "1a7ffc5c-d89c-44dd-8265-b1653d951ce0" } ], "count" : 10, "marker" : "5c90fa7d3c4e4405e8525079" }
Status Codes
Status Code |
Description |
---|---|
200 |
Successful response |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot