Create Active Alerts in Batch

Create active alerts in batch. Once an alert fails the format verification, all alerts cannot be created. Specific format error message will be returned.

Operation Permissions

Required Authorization

Required Operation Permission

orgId

Full Access

Request Format

POST https://{apigw-address}/event-service/v2.1/active-alerts?action=batchCreate

Request Parameters (URI)

Name

Location (Path/Query)

Required or Not

Data Type

Description

orgId

Query

true

String

Organization ID which the asset belongs to. How to get orgId>>

Request Parameters (Body)

Name

Required or Not

Data Type

Description

activeAlertList

true

ActiveAlert struct

Active alerts list. See ActiveAlert Struct>>

ActiveAlert Struct

Note

In the following non-required fields, you must provide measurepointId or deviceStatus to trigger the alert.

Name

Required or Not

Data Type

Description

assetId

true

String

Asset ID. How to get assetId>>

modelId

true

String

ID of the model applicable for the alert. How to get modelID>>

modelIdPath

false

String

Model path

measurepointId

false

String

Asset measurement point. How to get pointId>> </docs/api/en/2.1.0/api_faqs#how-to-get-the-measuremet-point-pointid>

deviceStatus

false

String

Device status, such as “offline”. Refer to xxxxxxxxxxxx </docs/alert/en/2.1.0/howto/setting_state_based_alert.html>

value

true

Object

Measurement point value

occurTime

true

Long

Occurrence time in UTC format. For time formats, see ISO8601 Standard Time Formats Used by UTC>>

localOccurTime

false

String

Occurrence time in local format. For time formats, see Data and Time Formats Used by Localtime>>

severityId

false

String

Alert severity ID

severityDesc

false

StringI18n

Alert severity description

typeId

false

String

Alert type ID

typeDesc

false

StringI18n

Alert type description

subTypeId

false

String

Alert sub-type ID

subTypeDesc

false

StringI18n

Alert sub-type description

contentId

false

String

Alert content ID

contentDesc

false

StringI18n

Alert content description

tags

false

tags data type

Tags

Response Parameters

Name

Data Type

Description

data

EnosBatchEachData struct

Success or fail message

EnosBatchEachData Struct

Name

Data Type

Description

code

Int

Failed or succeeded to create one alert: 0: succeeded, -1: failed

msg

String

Format is correct or not

data

String

If creation is successful, it is eventId, if failed, then it is error message

Sample

Request Sample

POST
https://{apigw-address}/event-service/v2.1/active-alerts?action=batchCreate&orgId=1c499110e8800000
{
    "activeAlertList": [{
        "assetId": "asset",
        "contentDesc": {
            "defaultValue": "default2",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "contentId": "content",
        "localOccurTime": "2019-11-07 15:15:58",
        "measurepointId": "point111",
        "modelId": "model",
        "modelIdPath": "/path-path-path",
        "occurTime": 1573110958644,
        "orgId": "o15475450989191",
        "severityDesc": {
            "defaultValue": "default",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "severityId": "severity",
        "tag": {
            "key1": " v1 "
        },
        "typeDesc": {
            "defaultValue": "default1",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "typeId": "type",
        "value": 1
    }]
}

Return Sample

{
    "code": 0,
    "msg": "OK",
    "requestId": "08f7c947-8c4e-4512-9764-58258173186e",
    "data": [{
        "code": 0,
        "msg": "format right",
        "data": "201911072a7658def1801fa23dc0ba494e2f38c8"
    }],
    "successSize": 1,
    "totalSize": 1
}