Create Message Rules


Create message rules.

Request Format


POST https://{apigw-address}/app-portal-service/v2.2/message-service/rule/create

Request Parameters (Header)


Name

Mandatory/Optional

Data Type

Description

Authorization

Optional

String

User identification.

Request Parameters (URI)


Name

Mandatory/Optional

Data Type

Description

orgId

Mandatory

String

OU ID.

Request Parameters (Body)


Name

Mandatory/Optional

Data Type

Description

appId

Mandatory

String

Application ID.

isEnable

Mandatory

String

Enable or disable the rule. 0 for disable, 1 for enable.

rules

Mandatory

RuleDTO Struct

Message rules.

relations

Optional

RelationDTO Struct

The users or user groups associated with the rules.

RuleDTO Struct


Name

Mandatory/Optional

Data Type

Description

ruleName

Mandatory

String

Message rule name.

messageRule

Mandatory

Object

Message rules.

RelationDTO Struct


Name

Mandatory/Optional

Data Type

Description

type

Optional

Integer

Type. 0 for user, 1 for user group.

identifiers

Optional

List

The list of users or user groups.

Response Parameters


Name

Data Type

Description

data

List

Message rule ID.

Error Codes


Error Code

Description

31400

OU ID is required.

31404

Possible causes: non-existed users, user groups, OU, or application; 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/create?orgId=your_org_id

method: POST

requestBody:
{
    "appId": "your_app_id",
    "rules": [
        {
            "isEnable": 0,
            "ruleName": "your_rule_name_1",
            "messageRule": {
                "mark1": ["siteA","siteB"],
                "mark2": ["deviceA","deviceB"],
                "mark3": ["fault"],
                "mark4": [""],
                "mark6": null
            }
        },
        {
            "isEnable": 0,
            "ruleName": "your_rule_name_2",
            "messageRule": {
                "mark1": ["siteA","siteB"],
                "mark2": ["deviceA","deviceB"],
                "mark3": ["fault"],
                "mark4": [""],
                "mark6": null
            }
        }
    ],
    "relations": [
        {
            "type": 0,
            "identifiers": ["your_id_1","your_id_2"]
        },
        {
            "type": 1,
            "identifiers": ["your_id_3"]
        }
    ]
}

Return Sample


{
    "code": 0,
    "message": "OK",
    "data": ["your_message_rule_id_1","your_message_rule_id_2"]
}