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

Requests immediate execution of a task definition. The response is the GUID of the executed job.

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>'