Update Message Rules¶
Update message rules.
Request Format¶
POST https://{apigw-address}/app-portal-service/v2.2/message-service/rule/update
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Required/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Required |
String |
OU ID. How to get orgId >> |
Request Parameters (Header)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
Authorization |
Optional |
String |
The access token generated after the user logs in and selects the OU, represented by Bearer Token, is in the form of
|
Request Parameters (Body)¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
ruleId |
Required |
String |
Message rule ID. |
ruleName |
Optional |
String |
Message rule name. If not specified, the name will not be updated. |
isEnable |
Optional |
String |
Whether to enable the rule. The following values are supported:
|
messageRule |
Required |
Object |
Conditions that trigger messages based on specific marks, such as assets, users, or event types. After specifying, the existing conditions in the rule will be overwritten. Each rule must contain 1 to 6 marks. Only when all marks in the rule are satisfied can the message be triggered. Marks are key-value pairs in the form of
For example, |
relations |
Optional |
RelationDTO Struct |
The users or user groups associated with the rule. If not specified, the objects associated with the rule will not be updated. relationDTO Struct >> |
RelationDTO Struct¶
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
type |
Optional. Required if you need to specify the associated object of the rule. |
Integer |
The object type. The following values are supported:
|
identifiers |
Optional. Required if you need to specify the associated object of the rule. |
List |
The ID of user or user group. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Boolean |
Update result. |
Error Codes¶
Error Code |
Description |
---|---|
31400 |
OU ID is required, parameters are invalid, etc. |
31404 |
Non-existed OU, application, user, user group, or message rules; or application not acquired. |
31600 |
Message rule error. |
31601 |
The number of message rules exceeds the limit. |
31602 |
The number of marks in the message rule exceeds the limit. |
31603 |
The message rule does not match. |
31604 |
Message rule marks are required. |
31607 |
Organization structure error. |
Samples¶
Request Sample¶
url: https://{apigw-address}/app-portal-service/v2.2/message-service/rule/update?orgId=your_org_id
method: POST
requestBody:
{
"ruleId": "your_rule_id",
"ruleName": "your_rule_name",
"isEnable": 0,
"messageRule": {
"mark1": ["siteA","siteB"],
"mark2": ["deviceA","deviceB"],
"mark3": ["fault"],
"mark4": [""],
"mark6": null
},
"relations": [
{
"type": 0,
"identifiers": ["your_user_id_1","your_user_id_2"]
},
{
"type": 1,
"identifiers": ["your_user_group_id"]
}
]
}
Return Sample¶
{
"code": 0,
"message": "OK",
"data": true
}