Search Alert Content¶
分页查询告警内容。
请求格式¶
POST https://{apigw-address}/event-service/v2.1/alert-contents?action=search
请求参数(URI)¶
名称  | 
位置(Path/Query)  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|---|
orgId  | 
Query  | 
必需  | 
String  | 
资产所属的组织 ID。 如何获取 orgId 信息>>  | 
请求参数(Body)¶
名称  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|
modelId  | 
可选  | 
String  | 
资产所属模型 ID。 如何获取 modelId 信息>>  | 
alertTypeId  | 
可选  | 
String  | 
告警类型 ID。  | 
subAlertTypeId  | 
可选  | 
String  | 
告警子类型 ID。  | 
expression  | 
可选  | 
String  | 
查询表达式,支持类 SQL 的查询。目前支持的逻辑运算是 and 和 or,查询的字段和对应的运算符清单如下。 
  | 
pagination  | 
可选  | 
Pagination 请求结构体  | 
分页的参数。如未指定,默认每页 10 条。默认按照   | 
响应参数¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
data  | 
AlertContent 结构体数组  | 
有关 AlertContent 结构体的定义。见 AlertContent 结构体>>  | 
AlertContent 结构体¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
contentId  | 
String  | 
内容ID。  | 
contentDesc  | 
StringI18n  | 
告警内容描述。结构请见 国际化名称结构体>>  | 
modelId  | 
String  | 
模型 ID。  | 
orgId  | 
String  | 
资产所属的组织 ID。  | 
alertType  | 
AlertType 结构体  | 
告警类型。AlertType 结构体>>  | 
subAlertType  | 
AlertType 结构体  | 
子告警类型。AlertType 结构体>>  | 
tags  | 
Map  | 
用户自定义告警内容标签。见 标签的作用与表示方法>>  | 
updatePerson  | 
String  | 
更新人员名称。  | 
updateTime  | 
Long  | 
最后一次更新时间。  | 
示例¶
请求示例¶
url: https://{apigw-address}/event-service/v2.1/alert-contents?action=search&orgId=yourOrgId
method: POST
requestBody:
{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "sorters": [{
            "field": "contentId",
            "order": "DESC"
        }]
    },
  "action": "search"
}
返回示例¶
{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "totalSize": 9,
        "sortedBy": [{
            "field": "contentId",
            "order": "DESC"
        }]
    },
    "code": 0,
    "msg": "OK",
    "requestId": "c4e28bda-8d76-4145-bc42-11bfc2c09c0d",
    "data": [{
        "contentId": "dateContentid",
        "contentDesc": {
      "defaultValue": null,
            "i18nValue": {
                "en_US": "dateContentid desc",
                "zh_CN": ""
            }
        },
        "modelId": "ssss",
        "orgId": "yourOrgId",
        "updatePerson": "test_user",
        "updateTime": 1546612131000,
        "alertType": {
            "typeId": "dateType",
      "orgId": "o15724268424841",
      "parentTypeId": null,
      "updatePerson": null,
      "source":null,
            "typeDesc": {
                "i18nValue": {
          "defaultValue": null,
                    "en_US": "dateType desc",
                    "zh_CN": ""
                }
            },
            "tags": {
            },
            "updateTime": 0
        },
        "subAlertType": {
            "typeDesc": {
                "i18nValue": {
          "defaultValue": null,
                    "en_US": "dateType desc",
                    "zh_CN": ""
                }
            },
      "orgId": "o15724268424841",
      "parentTypeId": null,
      "updatePerson": null,
      "source":null,
            "tags": {
            },
            "updateTime": 0
        },
        "tags": {
        }
    }]
}
Java SDK 调用示例¶
public void testSearchAlertContent() {
    private static String accessKey = "yourAppAccessKey";
    private static String secretKey = "yourAppSecretKey";
    private static String orgId = "yourOrgId";
    private static String url = "https://{apigw-address}";
    SearchAlertContentRequest request = new SearchAlertContentRequest();
    request.setOrgId(orgId);
    request.setModelId("ssss");
    Pagination pagination = new Pagination();
    pagination.setPageNo(1);
    pagination.setPageSize(1);
    List < Sorter > sorterList = new ArrayList < > ();
    sorterList.add(new Sorter("contentId", Sorter.Order.DESC));
    pagination.setSorters(sorterList);
    request.setPagination(pagination);
    try {
        SearchAlertContentResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url(url)
            .getResponse(request, SearchAlertContentResponse.class);
        Gson gson = new Gson();
        System.out.println(gson.toJson(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}