Update All Agents

Updates all agents with a package uploaded in a request body.

Request

HTTP Request

POST /node/api/agents/update

Permissions

upload-agent-updates

Path parameters

No parameters required.

Request body

Request body contains a binary file with an agent update. This file can be downloaded at the SAYMON Downloads Page.

Response

Response contains the result of an agent update.

A successful response looks like this:

"OK"

If you upload an incorrect file, the response will have the following body:

{
"code":"InvalidArgument",
"message":"Update file has wrong type (expected application/zip, application/x-zip or application/x-zip-compressed)."
}

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

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

curl -u $login:$password \
    -F "file=@saymon-agent-rl-update-archive.zip;type=application/zip" $url
The file can be selected with an HTML <input type="file" /> input element
let login = <...>
let password = <...>
let saymon_hostname = <...>
let path = "https://" + saymon_hostname + "/node/api/agents/update";
let auth = "Basic " + btoa(login + ":" + password);

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

let formData = new FormData();
let fileField = document.querySelector('input[type="file"]');

formData.append('file', fileField.files[0]);

let requestOptions = {
    method: "POST",
    headers: headers,
    body: formData
};

fetch(saymonHostname + path, requestOptions)
    .then(response => response.text())
    .then(result => console.log(result))
    .catch(error => console.log("error", error));
const request = require("request");
const fs = require("fs");

let login = <...>
let password = <...>
let saymon_hostname = <...>
let url = "https://" + saymon_hostname + "/node/api/agents/update";

let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    method: "POST",
    url: url,
    headers: {
        Authorization: auth
    },
    formData: {
        file: fs.createReadStream("saymon-agent-rl-update-archive.zip")
    }
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
    console.log(body);
});
import requests
import json

login = <...>
password = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/agents/update";

files = {
    "file": (
        "saymon-agent-rl-update-archive.zip",
        open("saymon-agent-rl-update-archive.zip", "rb"),
        "application/zip"
    )
}

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

Response

Successful response looks like this:

"OK"