Update History Alert Tags¶
更新历史告警的标签内容。
请求格式¶
POST https://{apigw-address}/event-service/v2.1/history-alerts?action=updateTags
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
|---|---|---|---|---|
orgId |
Query |
必需 |
String |
资产所属的组织ID。如何获取orgId信息>> |
请求参数(Body)¶
名称 |
必需/可选 |
数据类型 |
描述 |
|---|---|---|---|
eventId |
必需 |
String |
告警ID。 |
tags |
必需 |
Map |
想要修改的标签内容。详情见 标签的作用与表示方法>> |
isPatchUpdate |
必需 |
Boolean |
是否全量更新。
+ 当其值为 |
响应参数¶
名称 |
数据类型 |
描述 |
|---|---|---|
data |
Integer |
更新的条数。 |
输入输出示例¶
请求示例¶
url: https://{apigw-address}/event-service/v2.1/history-alerts?action=updateTags&orgId=yourOrgId
method: POST
requestBody:
{
"eventId": "yourEventId",
"isPatchUpdate": true,
"tags": {
"tag000": "000"
},
"action": "update"
}
返回示例¶
{
"code": 0,
"msg": "success",
"requestId": "4873095e-621d-4cfd-bc2c-edb520f574ea",
"data": 1
}
Java SDK调用示例¶
public void testUpdateHistoryAlertTags(){
String accessKey = "yourAppAccessKey";
String secretKey = "yourAppSecretKey";
UpdateHistoryAlertTagsRequest request = new UpdateHistoryAlertTagsRequest();
request.setOrgId("yourOrgId");
request.setEventId("yourEventId");
Map<String,String> map = new HashMap<>();
map.put("tag000","000");
request.setTags(map);
request.setIsPatchUpdate(true);
try {
UpdateHistoryAlertTagsResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url("https://{apigw-address}")
.getResponse(request, UpdateHistoryAlertTagsResponse.class);
System.out.println(response);
} catch(Exception e) {
System.out.print(e);
}
}