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


Samples

Request Sample


url: https://{apigw-address}/app-portal-service/v2.2/message-service/rule/create?orgId=oxxxxxxxxxxx

method: POST

requestBody:
{
    "appId": "5244f6e8-522c-43f6-af4e-e85xxxxxxxx",
    "rules": [
        {
            "isEnable": 0,
            "ruleName": "风机告警消息",
            "messageRule": {
                "mark1": ["siteA","siteB"],
                "mark2": ["deviceA","deviceB"],
                "mark3": ["fault"],
                "mark4": [""],
                "mark6": null
            }
        },
        {
            "isEnable": 0,
            "ruleName": "光伏告警消息",
            "messageRule": {
                "mark1": ["siteA","siteB"],
                "mark2": ["deviceA","deviceB"],
                "mark3": ["fault"],
                "mark4": [""],
                "mark6": null
            }
        }
    ],
    "relations": [
        {
            "type": 0,
            "identifiers": ["u1625647145xxxxxxx","u1625664785xxxxxxx"]
        },
        {
            "type": 1,
            "identifiers": ["ug1625650994xxxxxxx"]
        }
    ]
}

Return Sample


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