Modify a Rule Triggering Condition
Function
This API is used by an application to modify the configuration of a specific rule triggering condition 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
PUT /v5/iot/{project_id}/routing-rule/rules/{rule_id}
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. |
rule_id |
Yes |
String |
Parameter description: ID of the rule triggering condition. Value: The value can contain a maximum of 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
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. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
rule_name |
No |
String |
Parameter description: rule name. Value: The value can contain a maximum of 256 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed. |
description |
No |
String |
Parameter description: custom rule description. |
select |
No |
String |
Parameter description: custom SQL select statement. The value can contain up to 2500 characters. When updating a SQL statement, you must transfer the select and where parameters. If you need to clear the value of this parameter, set the parameter value to an empty string. This parameter is used only by users of the Standard and Enterprise editions. |
where |
No |
String |
Parameter description: custom SQL where statement. The value can contain up to 2500 characters. When updating a SQL statement, you must transfer the select and where parameters. If you need to clear the value of this parameter, set the parameter value to an empty string. This parameter is used only by users of the Standard and Enterprise editions. |
active |
No |
Boolean |
Parameter description: whether the rule triggering condition is activated. |
Response Parameters
Status code: 200
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
Modifies the trigger condition for the rule of the d89c-44dd-8265-b1653d951ce0 product.
PUT https://{endpoint}/v5/iot/{project_id}/routing-rule/rules/{rule_id} { "rule_name" : "rulename", "description" : "description", "select" : "*", "where" : "product_id='d89c-44dd-8265-b1653d951ce0'", "active" : true }
Example Responses
Status code: 200
OK
{ "rule_id" : "5bcaddda-75bf-4623-8c8d-26175c41fcca", "rule_name" : "rulename", "description" : "description", "subject" : { "resource" : "device", "event" : "create" }, "app_type" : "GLOBAL", "app_id" : "1a7ffc5cd89c44dd8265b1653d951ce0", "select" : "*", "where" : "product_id='d89c-44dd-8265-b1653d951ce0'", "active" : false }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
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