Отменить погашение аварии
Отменяет погашение аварии до того как авария перемещается в историю аварии. Учтите, что нельзя отменить погашение аварии, которая была удалена из списка активных аварий.
Этот запрос не отменяет действие удаления аварии.
Ответ
Тело ответа пустое.
При отмене погашения аварии, она возвращается в то состояние, в каком она была до погашения. Это состояние хранится в поле аварии lastState
-
Первоначальное состояние
-
Состояние после погашения
-
Состояние после отмены погашения
{
"entityId": "576bd6a04cbe34576bb662d3",
"entityType": 1,
"type": 1,
"localTimestamp": 1666083275092,
"state": 2,
"text": null,
"timestamp": 1666083275092,
"id": "634e69cb88a014a922a6f663"
}
{
"entityId": "576bd6a04cbe34576bb662d3",
"entityType": 1,
"type": 1,
"localTimestamp": 1666083275092,
"state": 3,
"text": null,
"timestamp": 1666083275092,
"clearTimestamp": 1666703637929,
"id": "634e69cb88a014a922a6f663"
}
{
"entityId": "576bd6a04cbe34576bb662d3",
"entityType": 1,
"type": 1,
"localTimestamp": 1666083275092,
"state": 2,
"text": null,
"timestamp": 1666083275092,
"id": "634e69cb88a014a922a6f663"
}
Пример
Запрос
-
Bash
-
JavaScript
-
NodeJS
-
Python
login=<...>
password=<...>
incident_id=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/incidents/$incident_id/undo-clear
curl -X POST $url -u $login:$password
let login = <...>
let password = <...>
let incidentId = <...>
let saymonHostname = <...>
let path = "/node/api/incidents/" + incidentId + "/undo-clear";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Authorization", auth);
let requestOptions = {
method: "POST",
headers: headers
};
fetch(saymonHostname + path, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log("error", error));
const http = require("http");
let login = <...>
let password = <...>
let incidentId = <...>
let saymonHostname = <...>
let path = "/node/api/incidents/" + incidentId + "/undo-clear";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "POST",
"hostname": saymonHostname,
"headers": {
Authorization: auth
},
"path": path
};
let req = http.request(options, function (res) {
let chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
let body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
import requests
login = <...>
password = <...>
incident_id = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/incidents/" + \
incident_id + "/undo-clear"
response = requests.request("POST", url, auth=(login, password))
print(response.text)