Обновить комментарий состояния

Обновить комментарий для записи истории состояний.

Запрос

HTTP Запрос

POST /node/api/state-history/:id/comment

Права

manage-history

Параметры пути

Параметр Тип Описание

id

String
обязательный

ID записи в истории состояния.

Параметры тела запроса

Тело запроса содержит строку с комментарием. Заголовок запроса Content-Type должен иметь значение text/plain.

Тело запроса

Тело запроса содержит строку с комментарием.

New state comment

Ответ

Тело ответа пустое. При отправке этого запроса, в поле comment заданной записи будет записана строка с комментарием.

Пример

Запрос

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
record_id=<...>
url=https://$saymon_hostname/node/api/state-history/$record_id/comment

curl -X POST $url -u $login:$password \
    -H "Content-Type: text/plain" \
    --data 'Hello from REST API!'
let login = <...>
let password = <...>
let saymonHostname = <...>
let recordId = <...>
let path = "/node/api/state-history/" + recordId + "/comment";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Content-Type", "text/plain");
headers.append("Authorization", auth);

let comment = "Hello from REST API!";

let requestOptions = {
    method: "POST",
    headers: headers,
    body: comment
};

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 saymonHostname = <...>
let recordId = <...>
let path = "/node/api/state-history/" + recordId + "/comment";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "POST",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth,
        "Content-Type": "text/plain"
    },
    "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);
    });
});


let comment = "Hello from REST API!";

req.write(comment);
req.end();
import requests

login = <...>
password = <...>
saymon_hostname = <...>
record_id = <...>
url = "https://" + saymon_hostname + "/node/api/state-history/" + \
    record_id + "/comment"

headers = {
    "Content-Type": "text/plain"
}

comment = "Hello from REST API!"

response = requests.request("POST", url, data=comment,
    headers=headers, auth=(login, password))
print(response.text)