Import a single or a list of tasks into the Task Planner. The secondary form of the command is /<taskID>/import.
The imported form can be derived from the Export Command. A single task definition can be obtained using the view command for a task.
Import a list of jobs or a single job. The command requires JSON input in the following form:
{ <TASK DEFINITION> } # or [ { <TASK DEFINITION 1> }, { <TASK DEFINITION 2> }, { <TASK DEFINITION 3> }, ... ]
The available properties of the JSON can be found here.
# Request # Use user:password for authorization POST /api/taskplanner/import HTTP/1.1 Content-Type: application/json Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u <JSON INPUT> # Response - List of Tasks HTTP/1.1 200 OK Content-Type: application/json Content-Length: <LENGTH>
# Shell access using curl curl -Lsu "username:password" \ --request POST --url "http://127.0.0.1:9000/api/taskplanner/import" \ --header 'content-type: application/json' \ --data '<JSON INPUT>'
The following notes should help to understand some common errors while importing tasks:
id
field will result in a new task for the logged in userid
field (or using the <taskID>/import
syntax) will result in an update of an existing task. If no such task exists, an error will be returned.ownerId
to be set and match the ownerId
of the existing task