Create History Alerts in Batch

Create history 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/history-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

historyAlertList

true

HistoryAlert struct

History alerts list. See HistoryAlert Struct

HistoryAlert 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-pointid>

deviceStatus

false

String

Device status, such as “offline”. Refer to xxxxxxxxxxxx.

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>>

recoverTime

true

Long

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

localRecoverTime

false

String

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

recoverReason

false

String

Recovery reason

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/history-alerts?action=batchCreate&orgId=1c499110e8800000
{
    "historyAlertList": [{
        "assetId": "asset",
        "contentDesc": {
            "defaultValue": "default2",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "contentId": "content",
        "localOccurTime": "2019-11-07 15:36:32",
        "localRecoverTime": "2019-11-18 00:00:00",
        "measurepointId": "point111",
        "modelId": "model",
        "modelIdPath": "/path-path-path",
        "occurTime": 1573025793008,
        "orgId": "o15475450989191",
        "recoverTime": 1573112193008,
        "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.0
    },
    {
        "assetId": "asset",
        "contentDesc": {
            "defaultValue": "default2",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "contentId": "content",
        "localOccurTime": "2019-11-07 15:36:33",
        "localRecoverTime": "2019-11-18 00:00:00",
        "measurepointId": "point111",
        "modelId": "model",
        "modelIdPath": "/path-path-path",
        "occurTime": 1573112193008,
        "orgId": "o15475450989191",
        "severityDesc": {
            "defaultValue": "default",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "severityId": "severity",
        "tag": {
            "key2": " v2 "
        },
        "typeDesc": {
            "defaultValue": "default1",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "typeId": "type",
        "value": 1.0
    },
    {
        "assetId": "asset",
        "contentDesc": {
            "defaultValue": "default2",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "contentId": "content",
        "localOccurTime": "2019-11-07 15:36:33",
        "localRecoverTime": "2019-11-18 00:00:00",
        "measurepointId": "point111",
        "modelId": "model",
        "modelIdPath": "/path-path-path",
        "occurTime": 1573112193012,
        "orgId": "o15475450989191",
        "recoverTime": 1573112193016,
        "severityDesc": {
            "defaultValue": "default",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "severityId": "severity",
        "tag": {
            "key3": " v3 "
        },
        "typeDesc": {
            "defaultValue": "default1",
            "i18nValue": {
                "en_US": "english",
                "zh_CN": "中文"
            }
        },
        "typeId": "type",
        "value": 1.0
    }]
}

Return Sample

{
    "code": 99206,
    "msg": "Partial Content Success",
    "requestId": "de9281bf-3ebf-4783-97c8-4b94be384351",
    "data": [{
        "code": 0,
        "msg": "format right",
        "data": "2019110630b8cc38735e8ba9d1b3a6b5e4381e36"
    },
    {
        "code": -1,
        "msg": "format wrong",
        "data": "recoverTime  :parameter empty"
    },
    {
        "code": 0,
        "msg": "format right",
        "data": "20191107bd6ab07f9be6ab769b1e7c898b40cc83"
    }],
    "successSize": 2,
    "totalSize": 3
}