Update Link Property

Updates a link property with data provided in a request body.

Request

HTTP Request

PATCH /node/api/links/:link_id/props/:prop_id

Permissions

linkPermissions & (manage-properties | manage-links)

The manage-service-properties permission is required for service properties.

Path parameters

Parameter Type Description

link_id

String
required

The ID of a link whose property should be updated.

prop_id

String
required

The ID of a property to be updated.

Body parameters

Field Type Description

name

String

Property’s name.

value

String

Property’s value.

type_id

Integer

Property’s type ID

Request body

{
    "name": "New Property Name",
    "value": "New Property Value",
    "type_id": 2
}

Response

The request returns an updated property (see the Property model), and the information about the link that the property is attached to (its ID in the owner_id field and its type in the owner_type field).

Field Type Description

id

String

Property’s ID.

name

String

Property’s name.

value

String

Property’s value.

type_id

Integer

Property’s type ID

owner_id

String

The ID of the link that the property is attached to.

owner_type

Integer

The type of the entity that the property is attached to. For a link, this value is 2

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
link_id=<...>
prop_id=<...>
url=https://$saymon_hostname/node/api/links/$link_id/props/$prop_id

curl -X PATCH $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF
{
    "value": "New Property Value"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>
let properyId = <...>
let path = "/node/api/links/" + linkId + "/props/" + properyId;
let auth = "Basic " + btoa(login + ":" + password);

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

let data = JSON.stringify({
    "name": "New Property Name"
});

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 linkId = <...>
let propId = <...>
let path = "/node/api/links/" + linkId + "/props/" + propId;
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({
    "value": "New Property Value"
});

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

login = <...>
password = <...>
saymon_hostname = <...>
link_id = <...>
property_id = <...>
url = "https://" + saymon_hostname + "/node/api/links/" + \
    link_id + "/props/" + property_id

body = {
    "value": "New Property Value"
}

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

Response

{
    "name": "1",
    "value": "New Property Value",
    "type_id": 1,
    "id": "5e678b3678bcdb2837883491",
    "owner_id":"62d7e5e456d203149a080038",
    "owner_type":2
}