Skip to content

Get Job by Object/Link ID

Returns the jobs related to specified objects or links for the specified time period. Note that this method returns jobs related to either links or objects, but not both at the same time.Permissions: objectPermissions, linkPermissions.!!! info If the requested job is related to the link, the user must have access to the objects connected by the link.

Request

HTTP Request

POST /node/api/jobs

Path parameters

No parameters required.

Body parameters

Parameter Type Description
links String The IDs of the links from which jobs are needed.
objects String The IDs of the objects from which jobs are needed.
from Integer
optional
Timestamp for the beginning of the time period.
to Integer
optional
Timestamp for the end of the time period.

Request body

The request body is empty.

Response

See the Job model.

Examples

Request examples

login=<...>
password=<...>
saymon_hostname=<...>
url=http://$saymon_hostname/node/api/jobs

curl -L -X POST '$url' \
-u $login:$password \
-H 'Content-Type: application/json' \
-d '{
"objects":["<object_id_1>", ... , "<object_id_n>"],
"from":<timestamp>,
"to":<timestamp>
}'
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/jobs"
let auth = "Basic " + btoa(login + ":" + password)
let myHeaders = new Headers()

myHeaders.append("Authorization", auth);
myHeaders.append("Content-Type", "application/json");

let raw = JSON.stringify({
  "objects":["<object_id_1>", ... , "<object_id_n>"],
  "from":<timestamp>,
  "to":<timestamp>
});

let requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  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': 'POST',
  'hostname': saymonHostname,
  'path': '/node/api/jobs',
  'headers': {
    'Authorization': auth,
    'Content-Type': 'application/json'
  },
  '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);
  });
});

let postData = JSON.stringify({
"objects":["<object_id_1>", ... , "<object_id_n>"],
"from":<timestamp>,
"to":<timestamp>
});

req.write(postData);

req.end();
import requests

login = <...>
password = <...>
saymon_hostname = <...>

url = 'http://' + saymon_hostname + '/node/api/jobs'

payload = {
    'objects':[
        '<object_id_1>',
        ... ,
        '<object_id_n>'
    ],
    'from':<timestamp>,
    'to':<timestamp>
}

headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload, auth=(login, password))

print(response.text)

Response example

{
    "description": {
        "exitCode": 0,
        "stdout": 70
    },
    "operation_id": "5ffefe930840567162d237f0",
    "owner_id": "5f914ff1cb8a5202de811751",
    "user_id": "5f5f420005a91e683e101ca7",
    "timestamp": 1610546837480,
    "results": [],
    "process_meta": null,
    "operation": {
        "name": "Counting"
    },
    "id": "5ffefe950840567162d23811"
}