Scroll Alerts¶
Search for active and history alerts. The first search returns a pageToken to be used for the next search, and all subsequent searches will return a different pageToken to be used for its next search.
Request Format¶
POST https://{apigw-address}/alert-service/v2.1/alerts?action=scroll
Request Parameters (URI)¶
| Name | Location (Path/Query) | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|---|
| orgId | Query | Mandatory | String | The organization ID which the asset belongs to. How to get orgId>> | 
Request Parameters (Body)¶
| Name | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|
| instanceId | Optional | String | The alert entity, which is the asset at this stage, with its value as the assetId. | 
| metricId | Optional | String | The metric, such as the measurement point. | 
| startOccurTime | Mandatory | String | The start time for triggering alert. To be used with  | 
| endOccurTime | Mandatory | String | The end time for triggering alert. To be used with  | 
| startRecoverTime | Optional | String | The start time of the alert recovery. To be used with  | 
| endRecoverTime | Optional | String | The end time of the alert recovery. To be used with  | 
| active | Optional | Boolean | 
 | 
| expression | Optional | String | The query expression, which supports sql-like query. The supported logical operators are “and” and “or”, and query fields are as per the below. 
 For more information about field description, see AlertVo Struct。 | 
| scroll | Mandatory | Scroll Struct | The parameters used for the search. Results can only be sorted based on  | 
Scroll Struct ¶
| Name | Mandatory/Optional | Data Type | Description | 
|---|---|---|---|
| pageSize | 
 | Integer | The number of records in each page, which must be greater than 0. | 
| pageToken | 
 | String | The token for the next page. | 
Response Parameters¶
| Name | Data Type | Description | 
|---|---|---|
| data | EnosScrollData Struct | The returned results. EnosScrollData Struct>> | 
EnosScrollData Struct¶
| Name | Data Type | Description | 
|---|---|---|
| pageToken | String | The token for the next page. | 
| pageSize | int | The number of records in each page. | 
| sortedBy | Array of Sorters Struct | The sorting method. For more information, see Sorters Struct>>. | 
| items | Array of AlertVo Structs | The list of alert records. For details of an AlertVo struct, see AlertVo Struct. | 
AlertVo Struct ¶
| Name | Data Type | Description | 
|---|---|---|
| alertId | String | The alert ID. | 
| eventType | Integer | 
 Only 2, 3, and 4 is applicable for Create Alert API. | 
| orgId | String | The organization ID which the asset belongs to. | 
| instanceId | String | The instance of the alert. At this stage there is only asset, thus it is the asset ID. | 
| metricId | String | The ID of the original metric data. | 
| occurTime | Long | The UTC time when the alert occurs. For time formats, see ISO8601 Standard Time Formats Used by UTC>> | 
| localOccurTime | String | The local time when the alert occurs. For time formats, see Data and Time Formats Used by Localtime>> | 
| recoverTime | Long | The recovery time in UTC format. For time formats, see ISO8601 Standard Time Formats Used by UTC>> | 
| localRecoverTime | String | The recovery time in local format. For time formats, see Data and Time Formats Used by Localtime>> | 
| recoverReason | String | The recovery reason. | 
| value | String | The metric value when the alert is generated. For alert functions such as multiple measurement point alerts or timed alerts, use the value of the metric that generates the alert. | 
| metricTags | Map | The metric data tag. The Key and Value are of String type. For more information, see How to use tags. 
 | 
| severityId | String | The alert severity ID. | 
| severityDesc | StringI18n | Specify the alert severity’s description in its respective locale’s language. For more details on the structure and locales supported, see Internationalized name struct. | 
| typeId | String | The alert type ID. | 
| typeDesc | StringI18n | Specify the alert type’s description in its respective locale’s language. For more details on the structure and locales supported, see Internationalized name struct. | 
| parentTypeId | String | The alert type ID of the parent alert. | 
| parentTypeDesc | StringI18n | The description of ID of the parent alert. For more details on the structure and locales supported, see Internationalized name struct. | 
| content | StringI18n | The alert content. For more details on the structure and locales supported, see Internationalized name struct. | 
| ruleId | String | The rule ID. | 
| ruleDesc | StringI18n | The rule description. For more details on the structure and locales supported, see Internationalized name struct. | 
| ruleTags | Map | The rule tag. | 
| tags | Map | The user-defined tags. (The Key and Value are of String type.) For more information, see How to use tags. | 
| inhibited | Boolean | 
 | 
Samples¶
First Request Sample¶
url: https://{apigw-address}/alert-service/v2.1/alerts?action=scroll&orgId=yourOrgId
method: POST
requestBody:
{
    "endOccurTime":"2020-11-15T00:00:00Z",
    "startOccurTime":"2020-10-10T00:00:00Z",
    "scroll":{
        "pageSize":1
    }
}
Return Sample¶
{
    "code":0,
    "msg":"OK",
    "requestId":"64a0ac08-eba9-4fc9-ab67-20092ec8a7c8",
    "data":{
        "items":[
            {
                "alertId":"202011146df8f354ebbebe233eee5a3bba2e3a00",
                "eventType":3,
                "orgId":"yourOrgId",
                "instanceId":"231",
                "metricId":"int1",
                "occurTime":1605372245417,
                "localOccurTime":"2020-11-02 00:00:00",
                "recoverTime":null,
                "localRecoverTime":null,
                "recoverReason":null,
                "value":"int1",
                "metricTags":{
                    "modelId":"moni01",
                    "modelIdPath":"/moni01"
                },
                "severityId":"setSeverityId",
                "severityDesc":{
                    "defaultValue":"defaultDeviceName12:44:05AM",
                    "i18nValue":{
                        "en_US":"EnglishName",
                        "zh_CN":"中文名"
                    }
                },
                "typeId":"setSubTypeId",
                "typeDesc":{
                    "defaultValue":null,
                    "i18nValue":{
                    }
                },
                "parentTypeId":"setTypeId",
                "parentTypeDesc":{
                    "defaultValue":null,
                    "i18nValue":{
                    }
                },
                "content":{
                    "defaultValue":null,
                    "i18nValue":{
                    }
                },
                "ruleId":null,
                "ruleDesc":null,
                "ruleTags":{
                    "color": "orange"
                },
                "tags":{
                    "223":"new",
                    "224":"new1"
                },
                "inhibited":null
            }
        ],
        "sortedBy":[
            {
                "field":"occurTime",
                "order":"DESC"
            },
            {
                "field":"alertId",
                "order":"DESC"
            }
        ],
        "pageToken":"pageTokenExample",
        "pageSize":1
    }
}
Second Request Sample¶
url: https://{apigw-address}/alert-service/v2.1/alerts?action=scroll&orgId=yourOrgId
method: POST
requestBody:
{
    "scroll":{
        "pageSize":0,
        "pageToken":"pageTokenExample"
    }
}
Return Sample¶
{
    "code":0,
    "msg":"OK",
    "requestId":"44addba6-22d6-4290-9ef9-d064d3adced6",
    "data":{
        "items":[
            {
                "alertId":"202011145d4b63f0241a9dfb16f705d67cadadc3",
                "eventType":3,
                "orgId":"o15475450989191",
                "instanceId":"testBatch",
                "metricId":"int1",
                "occurTime":1605372245417,
                "localOccurTime":"2021-01-02 00:00:00",
                "recoverTime":null,
                "localRecoverTime":null,
                "recoverReason":null,
                "value":"int1",
                "metricTags":{
                    "modelId":"CCmodel",
                    "modelIdPath":"/CCmodel"
                },
                "severityId":"setSeverityId1",
                "severityDesc":null,
                "typeId":"setSubTypeId",
                "typeDesc":null,
                "parentTypeId":"setTypeId1",
                "parentTypeDesc":null,
                "content":null,
                "ruleId":null,
                "ruleDesc":null,
                "ruleTags":{
                    "color": "orange"
                },
                "tags":{
                },
                "inhibited":null
            }
        ],
        "sortedBy":[
            {
                "field":"occurTime",
                "order":"DESC"
            },
            {
                "field":"alertId",
                "order":"DESC"
            }
        ],
        "pageToken":"pageToken2",
        "pageSize":0
    }
}