Skip to content

Get All Links (particular fields)

Work in Progress

This topic is a work in progress and may be incomplete.

GET /node/api/links?fields=<field_1>,...,<field_n>

Returns all links with information only from specified fields.

Info

Links' IDs are always returned, regardless of specifying the id field.

Request parameters

All usable fields are in the table below:

Field Description
class_id Link's class ID
client_data Information about link's settings
created Timestamp for the moment of link's creation
id Link's ID
last_state_update Timestamp for the moment of the last state changing
manual_state Details about manually changed state
operations Link's operations
owner_id Link's owner ID
properties List of link's properties and metrics' values
source Link's source object ID
state_id Link's state ID
tags List of link's tags
target Link's targeted object ID
updated Timestamp for the moment of link's last update
weight Link's weight coefficient

Examples

Request examples

login=<...>
password=<...>
saymon_hostname=<...>
url=http://$saymon_hostname/node/api/links?fields=source,target

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/links?fields=source,target"
let auth = "Basic " + btoa(login + ":" + password)
var myHeaders = new Headers();

myHeaders.append("Authorization", auth);

let requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch(saymonHostname + path, requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
let http = require('follow-redirects').http;
let fs = require('fs');
let saymonHostname = <...>
let login = <...>;
let password = <...>;
let auth = 'Basic ' + Buffer.from(login + ':' + password).toString('base64');


let options = {
  'method': 'GET',
  'hostname': saymonHostname,
  'path': '/node/api/links?fields=source,target',
  'headers': {
    'Authorization': auth
  },
  'maxRedirects': 20
};

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 = <...>
url = 'http://' + saymon_hostname + '/node/api/links?fields=source,target'

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

print(response.text)

Response example

[
    {
        "source": 131,
        "target": 130,
        "id": 17
    },
    ...
]