Modify Property Class

Modifies a property class.

Request

HTTP Request

PATCH /node/api/property-classes/:id

Permissions

manage-property-classes

Path parameters

Parameter Type Description

id

String
required

The ID of a property class.

Request body

{
    "name": "Updated name",
    "description": "Updated description",
    "multiple": true,
    "multiple_separator": ";",
    "value_display_template": "",
    "source": "66e41e89029ed40f1105e59e",
    "mask": ""
}

Response

Response body contains an updated property classes.

Модель класса свойств
Field Type Description

name

String

Name of the property class.

description

String

Description of the property class.

value_type_id

String

ID of the value type this property class uses.

value

Object

Default value of the property.

multiple

Boolean

Whether this property class has multiple values per key.

source

String

ID of the dictionary used as the source of the values for dictionary value type.

mask

String

Filter for the acceptable value that is defined with a regular expression.

system

Boolean

Whether this is a built-in property class.

id

String

ID of the property class.

multiple_separator

String

String that separates multiple values when displayed in the web interface.

value_display_template

String

Template used when displaying values in a web interface. You can use {{0}} to access the property’s value.

Dictionaries use the following indexing – you can access the key with {{0}}; {{1}}{{N}} used to access dictionary’s values.

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
flow_id=<...>
url=https://$saymon_hostname/node/api/flows/$flow_id

curl -X PATCH $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF
{
    "description": "Updated description"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let flowId = <...>
let path = "/node/api/flows/" + flowId;
let auth = "Basic " + btoa(login + ":" + password);

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

let data = JSON.stringify({
    "description": "Updated description"
});

let requestOptions = {
    method: "PATCH",
    headers: headers,
    body: data
};

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

let options = {
    "method": "PATCH",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth,
        "Content-Type": "application/json"
    },
    "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 data = JSON.stringify({
    "description": "Updated description"
});

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

login = <...>
password = <...>
saymon_hostname = <...>
flow_id = <...>
url = "https://" + saymon_hostname + "/node/api/flows/" + flow_id

body = {
    "description": "Updated description"
}

response = requests.request("PATCH", url, json=body, auth=(login, password))
print(response.text)

Response

{
    "id": "66e9850cbb17541c30c88348",
    "name": "Updated name",
    "description": "Updated description",
    "value_type_id": "dictionary",
    "value": "",
    "multiple": true,
    "multiple_separator": ";",
    "value_display_template": "",
    "source": "66e41e89029ed40f1105e59e",
    "mask": ""
}