Get All Presets

Returns an array of all preset.

Request

HTTP Request

GET /node/api/presets

Path parameters

No parameters required.

Request body

The request body is empty.

Response

Returns an array of all presets in the system. Each preset contains the following fields:

Field Type Description

id

String

ID of the preset.

name

String

Name of the preset.

key

String

Preset key. Used to filter presets. See the list of all pre-defined keys in the Preset Data section.

data

Object

Preset data. See the Preset Data for more information.

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

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

curl -X GET $url -u $login:$password
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/presets";
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 path = "/node/api/presets";
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 = <...>
url = "https://" + saymon_hostname + "/node/api/presets"

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

Response

[
    {
        "name": "preset1",
        "id": "59844a6969066c3615092184",
        "key": "incident-page-preset-picker",
        "data": {
            "sortData": {
                "column": "entity",
                "direction": "asc"
            },
            "visibleHeaderIds": [
                [
                    "severity",
                    false
                ],
                [
                    "occurredTime",
                    false
                ],
                [
                    "clearedTime",
                    false
                ],
                [
                    "registeredTime",
                    false
                ]
            ],
            "columnOrder": [
                "clearedTime",
                "entity",
                "registeredTime",
                "text",
                "acknowledgedBy",
                "comment",
                "data.mediaUrl"
            ]
        }
    },
    {
        "name": "preset2",
        "data": {
            "filter": [
                "$or",
                [
                    [
                        "$and",
                        [
                            [
                                "classId",
                                "1024"
                            ]
                        ]
                    ]
                ]
            ],
            "defaultViewPreset": "preset1"
        },
        "key": "incident-page-filter-filter-preset-picker",
        "id": "5a05c1978c606c2edca6296c"
    },
    ...
]

See Also