Update Active Alert Tags

更新当前告警的标签内容。

请求格式

POST https://{apigw-address}/event-service/v2.1/active-alerts?action=updateTags

请求参数(URI)

名称

位置(Path/Query)

必需/可选

数据类型

描述

orgId

Query

必需

String

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

请求参数(Body)

名称

必需/可选

数据类型

描述

eventId

必需

String

告警ID。

tags

必需

Map

想要修改的标签内容。参见 标签的作用与表示方法>>

isPatchUpdate

必需

Boolean

是否全量更新。 + 当其值为 true 时,只更新参数中指定字段的值; + 当其值为 false 时,更新所有字段的值,即未指定值的字段将被置空。

响应参数

名称

数据类型

描述

data

Integer

更新的条数。

示例

请求示例

url: https://{apigw-address}/event-service/v2.1/active-alerts?action=updateTags&orgId=yourOrgId
method: POST
requestBody:
{
    "eventId": "yourEventId",
    "isPatchUpdate": false,
    "tags": {
        "Tag999": "999"
    },
  "action": "update"
}

返回示例

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

Java SDK调用示例

public void testUpdateActiveAlertTags(){
       String accessKey = "yourAppAccessKey";
       String secretKey = "yourAppSecretKey";

       UpdateActiveAlertTagsRequest request = new UpdateActiveAlertTagsRequest();
       request.setOrgId("yourOrgId");
       request.setEventId("yourEventId");
       Map<String,String> map = new HashMap<>();
       map.put("yourTagKey","yourTagValue");
       request.setTags(map);
       request.setIsPatchUpdate(false);
       try {
           UpdateActiveAlertTagsResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
                       .url("https://{apigw-address}")
                       .getResponse(request, UpdateActiveAlertTagsResponse.class);
           System.out.println(new Gson().toJson(response));
       } catch(Exception e) {
           System.out.print(e);
       }
}