Get Alert Content¶
根据组织ID和内容ID获取告警内容。
请求格式¶
GET https://{apigw-address}/event-service/v2.1/alert-contents?action=get
请求参数(URI)¶
名称  | 
位置(Path/Query)  | 
必需/可选  | 
数据类型  | 
描述  | 
|---|---|---|---|---|
orgId  | 
Query  | 
必需  | 
String  | 
资产所属的组织ID。 如何获取orgId信息>>  | 
contentId  | 
Query  | 
必需  | 
String  | 
告警内容ID。  | 
响应参数¶
名称  | 
数据类型  | 
描述  | 
|---|---|---|
data  | 
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=get&contentId=yourContentId&orgId=yourOrgId
method: GET
返回示例¶
{
    "code": 0,
    "msg": "OK",
    "requestId": "f40fbb09-ce20-463f-bb18-6659a8bd6926",
    "data": {
        "contentId": "yourContentId",
        "contentDesc": {
            "i18nValue": {
                "defaultValue": null,
                "en_US": "Content desc",
                "zh_CN": ""
            }
        },
        "modelId": "ssss",
        "orgId": "yourOrgId",
        "updatePerson": "yj_test_customer",
        "updateTime": 1546612131000,
        "alertType": {
            "typeId": "doubleType",
            "parentTypeId": null,
            "updatePerson": null,
      "source": null,
            "typeDesc": {
                "i18nValue": {
                    "defaultValue": null,
                    "en_US": "doubleType desc",
                    "zh_CN": ""
                }
            },
            "tags": {
            },
            "updateTime": 0
        },
        "subAlertType": {
            "typeDesc": {
                "i18nValue": {
                    "defaultValue": null,
                    "en_US": "doubleType desc",
                    "zh_CN": ""
                }
            },
            "tags": {
            },
            "parentTypeId": null,
            "updatePerson": null,
      "source": null,
            "updateTime": 0
        },
        "tags": {
        }
    },
  "action": "get"
}
Java SDK调用示例¶
public void testGetAlertContent() {
    private static String accessKey = "yourAppAccessKey";
    private static String secretKey = "yourAppSecretKey";
    private static String orgId = "yourOrgId";
    private static String url = "https://{apigw-address}";
    final String contentId = "yourContentId";
    GetAlertContentRequest request = new GetAlertContentRequest();
    request.setOrgId(orgId);
    request.setContentId(contentId);
    try {
        GetAlertContentResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url(url)
            .getResponse(request, GetAlertContentResponse.class);
        Gson gson = new Gson();
        System.out.println(gson.toJson(response));
        if (response.getCode() == 0) {
            System.out.println(response.getData());
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}