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
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=http://$saymon_hostname/node/api/jobs
5
6
curl -L -X POST '$url' \
7
-u $login:$password \
8
-H 'Content-Type: application/json' \
9
-d '{
10
"objects":["<object_id_1>", ... , "<object_id_n>"],
11
"from":<timestamp>,
12
"to":<timestamp>
13
}'
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/jobs"
5
let auth = "Basic " + btoa(login + ":" + password)
6
let myHeaders = new Headers()
7
8
myHeaders.append("Authorization", auth);
9
myHeaders.append("Content-Type", "application/json");
10
11
let raw = JSON.stringify({
12
"objects":["<object_id_1>", ... , "<object_id_n>"],
13
"from":<timestamp>,
14
"to":<timestamp>
15
});
16
17
let requestOptions = {
18
method: 'POST',
19
headers: myHeaders,
20
body: raw,
21
redirect: 'follow'
22
};
23
24
fetch(saymonHostname + path, requestOptions)
25
.then(response => response.text())
26
.then(result => console.log(result))
27
.catch(error => console.log('error', error));
Copied!
1
let http = require('follow-redirects').http;
2
let fs = require('fs');
3
let saymonHostname = <...>;
4
let login = <...>;
5
let password = <...>;
6
let auth = 'Basic ' + Buffer.from(login + ':' + password).toString('base64');
7
8
let options = {
9
'method': 'POST',
10
'hostname': saymonHostname,
11
'path': '/node/api/jobs',
12
'headers': {
13
'Authorization': auth,
14
'Content-Type': 'application/json'
15
},
16
'maxRedirects': 20
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let postData = JSON.stringify({
37
"objects":["<object_id_1>", ... , "<object_id_n>"],
38
"from":<timestamp>,
39
"to":<timestamp>
40
});
41
42
req.write(postData);
43
44
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
7
url = 'http://' + saymon_hostname + '/node/api/jobs'
8
9
payload = {
10
'objects':[
11
'<object_id_1>',
12
... ,
13
'<object_id_n>'
14
],
15
'from':<timestamp>,
16
'to':<timestamp>
17
}
18
19
headers = {
20
'Content-Type': 'application/json'
21
}
22
23
response = requests.request("POST", url, headers=headers, data=payload, auth=(login, password))
24
25
print(response.text)
26
Copied!

Response example

1
{
2
"description": {
3
"exitCode": 0,
4
"stdout": 70
5
},
6
"operation_id": "5ffefe930840567162d237f0",
7
"owner_id": "5f914ff1cb8a5202de811751",
8
"user_id": "5f5f420005a91e683e101ca7",
9
"timestamp": 1610546837480,
10
"results": [],
11
"process_meta": null,
12
"operation": {
13
"name": "Counting"
14
},
15
"id": "5ffefe950840567162d23811"
16
}
Copied!
Last modified 9mo ago