Skip to content

Get Link by ID

Returns a link with the specified ID.

Request

HTTP Request

GET /node/api/links/:id

Path parameters

Parameter Type Description
id String
required
The ID of a link to be retrieved.

Request body

The request body is empty.

Response

The response contains the requested link in the JSON format. See the Link model page for more information.

Example

Request

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

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let linkId = <...>
let path = "/node/api/links/" + linkId;
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Authorization", auth);

let requestOptions = {
    method: "GET",
    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 saymonHostname = <...>
let linkId = <...>
let path = "/node/api/links/" + linkId;
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "GET",
    "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 = <...>
saymon_hostname = <...>
link_id = <...>
url = "https://" + saymon_hostname + "/node/api/links/" + link_id

response = requests.request("GET", url, auth=(login, password))
print(response.text)

Response

{
"source": "62d7e5d456d203149a080026",
"target": "62d7e5da56d203149a08002f",
"state_id": 3,
"client_data": "{\"headlinePropIds\":[],\"showArrow\":true,\"connectorStyle\":\"Bezier\",\"nonPinnedSections\":{\"operations\":true}}",
"tags": [],
"operations": [
    {
        "name": "Operation",
        "parameters": {
            "topic": "Test MQTT Operation",
            "message": "MQTT Message Text"
        },
        "description": "",
        "popupResult": true,
        "type": 1,
        "id": "62de8eed361a5d7ec2768057"
    }
],
"owner_id": "57ff6853fa6db3a63d16d07b",
"updated": 1659614426833,
"properties": [
    {
        "type_id": 1,
        "name": "Property",
        "value": "Value",
        "id": "62eb963bb8ff53567ebda39b"
    }
],
"class_id": 35,
"created": 1658316260154,
"last_state_update": 1659606656820,
"weight": 1,
"_stateConditionRefs": [],
"manual_state": null,
"id": "62d7e5e456d203149a080038"
}

See Also