Execute
Schedules immediate execution of a task specified by it's definition. A task definition is a JSON representation of the job and its actions. Existing jobs can be run using their task id too.
The JSON object has the following form:
{ "jobs": [ { <JOB DEFINITION 1> }, { <JOB DEFINITION 2> }, ... ], "resultactions": [ { <ACTION DEFINITION 1> }, { <ACTION DEFINITION 2> }, ... ] }
The actual <JOB DEFINITION>
and <ACTION DEFINITION>
can be acquired by creating a template task in the Task Planner and exporting it. The basic layout is defined here.
POST /api/taskplanner/execute
This API allows for the immediate execution of a task definition and returns the GUID
of the executed job. This GUID
can be used to request further details about the executed job. If details are not requested within 60 seconds, the job will no longer be held in the cache and will not be available for further inspection. However, if details are requested within this timeframe, the timeout will be renewed.
Example Request
# Request # Use user:password for authorization POST /api/taskplanner/execute HTTP/1.1 Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u <TASK JSON> # Response - Task is scheduled for execution HTTP/1.1 200 OK Content-Type: application/json Content-Length: 27 "4jg6dmy0jb1nzk45moo9ih7pr"
Application Example
# Shell access using curl curl -Ls "http://127.0.0.1:9000/api/taskplanner/execute" --request POST \ --header 'Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u' \ --header 'content-type: application/json' \ --data '<TASK JSON>' # Shell access using curl with username and password curl -Lsu username:password "http://127.0.0.1:9000/api/taskplanner/execute" --request POST \ --header 'content-type: application/json' \ --data '<TASK JSON>'