Get Job by Object/Link ID

POST /node/api/jobs

Returns the jobs related to specified objects or links for specified time period.

Permissions: objectPermissions, linkPermissions.

The method does not work with objects and links simultaneously.

In case of a link the user must have access to the objects connected by the link.

Request parameters

Body parameters

Parameter

Type

Description

from

integer optional

Timestamp for the beginning of the time period.

links

string

The IDs of the links from which jobs are needed.

objects

string

The IDs of the objects from which jobs are needed.

to

integer optional

Timestamp for the end of the time period.

Response description

See the Job model.

Examples

Request examples

Bash
Javascript
NodeJS
Python
Bash
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>
}'
Javascript
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));
NodeJS
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();
Python
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"
}