Delete Alert Content


删除告警内容。需要校验告警内容是否被其它规则使用,若有规则使用,则不允许删除。

请求格式

POST https://{apigw-address}/event-service/v2.1/alert-contents?action=delete

请求参数(URI)

名称

位置(Path/Query)

必需/可选 - 数据类型 - 描述

orgId

Query

必需 - String - 资产所属的组织ID。 如何获取orgId信息>>

alertContentId

Query

必需 - String - 告警内容编号。

示例

请求示例

url: https://{apigw-address}/event-service/v2.1/alert-rules?action=delete&orgId=yourOrgId&alertContentId=yourAlertContentId
method: POST
requestBody:
{
  "action": "delete"
}

返回示例

{
    "code": 0,
    "msg": "OK",
    "requestId": "4873095e-621d-4cfd-bc2c-edb520f574ea",
    "data": ""
}

Java SDK调用示例

public void testDeleteAlertContent() {
    private static String accessKey = "yourAppAccessKey";
    private static String secretKey = "yourAppSecretKey";
    private static String orgId = "yourOrgId";
    private static String url = "https://{apigw-address}";
    DeleteAlertContentRequest request = new DeleteAlertContentRequest();
    request.setOrgId(orgId);
    request.setAlertContentId("yourContentId");
    try {
        DeleteAlertContentResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url(url)
            .getResponse(request, DeleteAlertContentResponse.class);
        Gson gson = new Gson();
        System.out.println(gson.toJson(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}