Search Alert Type¶
分页查询告警类型。
请求格式¶
POST https://{apigw-address}/event-service/v2.1/alert-types?action=search
请求参数(URI)¶
名称  | 
位置(Path/Query)  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|---|
orgId  | 
Query  | 
必需  | 
String  | 
资产所属的组织 ID。 如何获取 orgId 信息>>  | 
请求参数(Body)¶
名称  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|
expression  | 
可选  | 
String  | 
查询表达式,支持类 SQL 的查询。目前支持的逻辑运算是 and 和 or,查询的字段和对应的运算符清单如下。 
  | 
pagination  | 
可选  | 
Pagination 请求结构体  | 
分页的参数。如未指定,默认每页 10 条。默认按照   | 
响应参数¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
data  | 
AlertType 结构体数组  | 
告警类型数组。有关 AlertType 结构体的定义,见 AlertType 结构体>>  | 
AlertType 结构体¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
typeId  | 
String  | 
告警类型 ID。  | 
typeDesc  | 
StringI18n  | 
告警类型描述。  | 
orgId  | 
String  | 
资产所属的组织 ID。  | 
parentTypeId  | 
String  | 
父告警类型编号。如果为   | 
tags  | 
Tag 结构体  | 
标签。  | 
updatePerson  | 
String  | 
更新人。  | 
updateTime  | 
Long  | 
更新的 UTC 时间。  | 
输入输出示例¶
请求示例¶
url: https://{apigw-address}/event-service/v2.1/alert-types?action=search&orgId=yourOrgId
method: POST
requestBody:
{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "sorters": [{
            "field": "typeId",
            "order": "DESC"
        }]
    },
  "action": "search"
}
返回示例¶
{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "totalSize": 14,
        "sortedBy": [{
            "field": "typeId",
            "order": "DESC"
        }]
    },
    "code": 0,
    "msg": "OK",
    "requestId": "c1be09d8-a6f2-4647-92e1-3c545fa1b3dd",
    "data": [{
        "typeId": "dateType",
        "orgId": "yourOrgId",
        "typeDesc": {
            "i18nValue": {
        "defaultValue": null,
                "en_US": "dateType desc",
                "zh_CN": ""
            }
        },
        "tags": {
        },
        "updatePerson": "yj_test_customer",
        "updateTime": 1546612655000
    }]
}
Java SDK 调用示例¶
public void testSearchAlertType() {
    SearchAlertTypeRequest request = new SearchAlertTypeRequest();
    request.setOrgId(orgId);
    Pagination pagination = new Pagination();
    pagination.setPageNo(1);
    pagination.setPageSize(1);
    List < Sorter > sorterList = new ArrayList < > ();
    sorterList.add(new Sorter("typeId", Sorter.Order.DESC));
    pagination.setSorters(sorterList);
    request.setPagination(pagination);
    try {
        SearchAlertTypeResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url("https://{apigw-address}")
            .getResponse(request, SearchAlertTypeResponse.class);
        Gson gson = new Gson();
        System.out.println(gson.toJson(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}