Close Alert¶
Close an active alert. A closed active alert will become a history alert.
Request Format¶
POST https://{apigw-address}/alert-service/v2.1/alerts?action=close
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
alertId |
Mandatory |
String |
The alert ID. |
recoverTime |
Mandatory |
Long |
The recovery time in UTC format. For time formats, see ISO8601 Standard Time Formats Used by UTC. |
localRecoverTime |
Optional |
String |
The recovery time in local format. For time formats, see Data and Time Formats Used by Localtime. |
recoverReason |
Optional |
String |
The recovery reason. |
Samples¶
Request Sample¶
url: https://{apigw-address}/alert-service/v2.1/alerts?action=close&orgId=yourOrgId
method: POST
{
"alertId":"20201109a7451eac2ef7b562bd673198e55d0019",
"recoverTime":1559304899404,
"localRecoverTime":"2019-06-01 02:14:59",
"recoverReason":"Reason"
}
Return Sample¶
Closed Successfully¶
{
"code":0,
"msg":"OK",
"requestId":"4c69be41-c8b8-4e48-9a79-16af759c35e7"
}
Close Failed¶
{
"code":99400,
"msg":"invalid id:20201109a7451eac2ef7b562bd673198e55d0019 :ID does not exist",
"requestId":"4c69be41-c8b8-4e48-9a79-16af759c35e7"
}
Java SDK Sample¶
public void testCloseAlert(){
String accessKey = "yourAppAccessKey";
String secretKey = "yourAppSecretKey";
String orgId = "yourOrgId";
String url = "https://{apigw-address}";
CloseAlertRequest request = new CloseAlertRequest();
request.setAlertId("yourEventId");
request.setLocalRecoverTime("2019-08-19 00:00:00");
request.setRecoverTime(System.currentTimeMillis());
request.setOrgId(orgId);
request.setRecoverReason("yourRecoverReason");
try {
CloseAlertResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url(url)
.getResponse(request, CloseAlertResponse.class);
System.out.println(response);
} catch (Exception e) {
System.out.print(e);
}
}