Delete Alert Rule


删除指定编号的告警规则。

请求格式

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

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

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

ruleId

Query

必需

String

需要删除的告警规则编号。

示例

请求示例

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

返回示例

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

Java SDK调用示例

public void testDeleteRule() {
    private static String accessKey = "yourAppAccessKey";
    private static String secretKey = "yourAppSecretKey";
    private static String orgId = "yourOrgId";
    private static String url = "https://{apigw-address}";
    DeleteAlertRuleRequest request = new DeleteAlertRuleRequest();
    request.setOrgId(orgId);
    request.setRuleId("yourRuleId");
    try {
        DeleteAlertRuleResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url(url)
            .getResponse(request, DeleteAlertRuleResponse.class);
        System.out.println(response);
    } catch (Exception e) {
        System.out.print(e);
    }
}