Update State Comment

Updates a comment for a state history record.

Request

HTTP Request

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

Permissions

manage-history

Path parameters

Parameter Type Description

id

String
required

The ID of a state history record whose comment should be updated.

Body parameters

The body contains a comment as a plain-text string. Note that you should also specify the Content-Type header as text/plain.

Request body

The body contains a comment as a plain-text string.

New state comment

Response

The response body is empty. When you send this request, the comment field of the specified state history record is set to the string passed in the request body.

Example

Request

  • 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)