Add Custom Job Result
Adds a new custom result to a job's results list.
Request
HTTP Request
Permissions
Path parameters
Parameter | Type | Description |
---|---|---|
id | Stringrequired |
The ID of a job for which a new result should be added. |
Request body
The request body contains a set of custom parameters that you would like to include in the job result.
The example request:
{
"String property": "Value",
"Integer property": 1234,
"Boolean property": true,
"Array property":[
"Value",
"Another Value"
]
}
Response
The response body is empty.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let jobId = <...>
let path = "/node/api/jobs/" + jobId + "/results";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);
let data = JSON.stringify({
"custom property": "some value"
"another custom property": "another value"
});
let requestOptions = {
method: "PATCH",
headers: headers,
body: data
};
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 jobId = <...>
let path = "/node/api/jobs/" + job_id + "/results";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "PATCH",
"hostname": saymonHostname,
"headers": {
"Authorization": auth,
"Content-Type": "application/json"
},
"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);
});
});
let data = JSON.stringify({
"custom property": "some value"
"another custom property": "another value"
});
req.write(data);
req.end();
import requests
login = <...>
password = <...>
saymon_hostname = <...>
job_id = <...>
url = "http://" + saymon_hostname + "/node/api/jobs/" + job_id + "/results"
body = {
"custom property": "some value"
"another custom property": "another value"
}
response = requests.request("PATCH", url, json=body, auth=(login, password))
print(response.text)
Result
If this request succeeded, the target job would have a new value in the results
array:
{
"description": {
"stdout": "Hello World!",
"exitCode": 0
},
"results": [
{
"payload": {
"custom property": "some value"
"another custom property": "another value"
},
"by": "62c2f3ce80c8654892764d56",
"timestamp": 1658926668678
}
{
"payload": {
"pre-existing property": "pre-existing value"
},
"by": "62c2f3ce80c8654892764d56",
"timestamp": 1658753182720
}
],
...
"id": "62de90b0b238aa0131bd3b8f"
}