Task definitions [VC 21.3 GEN]

Jobs are made up of a number of tasks that execute in a specific order.


Task definitions

Retrieve task definitions

GET /task-definition Retrieves all tasks that have been defined in the system. Query Parameters: type (string) – Job type to retrieve task definitions for. Produces: application/xml, application/json – TaskDefinitionListDocument Role: _taskdefinition_read

Retrieve task definitions by type

GET /task-definition/jobtype/(type) Retrieves the tasks that have been defined for a specific job type. Produces: application/xml, application/json – TaskDefinitionListDocument Role: _taskdefinition_read

Define new task

POST /task-definition Defines one or more new tasks. Query Parameters: url (boolean) – true - Return list of URLs. false (default) - Return list of ids. Accepts: application/xml, application/json – TaskDefinitionListDocument Produces: application/xml, application/json – URIListDocument Role: _taskdefinition_write

Retrieve a task

GET /task-definition/(task-id) GET /task-definition/jobtype/(type)/step/(step) Retrieves the definition document for a task with a specific id. Produces: application/xml, application/json – TaskDefinitionDocument Role: _taskdefinition_read

Validate a task

GET /task-definition/(task-id)/validate GET /task-definition/jobtype/(type)/step/(step)/validate Verifies that the bean referred to in the task can be resolved and that it contains the specified method. Does nothing if the task is a script task. Status Codes: 200 – The bean and method exists. 400 – If the bean or method could not be found. Produces: text/plain – Informational status text. Role: _taskdefinition_read

Delete a task

DELETE /task-definition/(task-id) DELETE /task-definition/jobtype/(type)/step/(step) Deletes the task. Role: _taskdefinition_write

Update an existing task

PUT /task-definition/(task-id) PUT /task-definition/jobtype/(type)/step/(step) Updates the task. Accepts: application/xml, application/json – TaskDefinitionDocument Produces: application/xml, application/json – TaskDefinitionDocument Role: _taskdefinition_write

Custom job types

Create a new custom job type

POST /task-definition/jobtype/(type) Creates a new job type with the specified name. The recommended format of the type path parameter is {VENDOR_PREFIX}_{JOB_TYPE}. Query Parameters: id (integer) – Required. An integer between 20000 and 30000, must be unique among job types. Status Codes: 409 – Name or id already taken. 400 – If name or id was not specified. Produces: application/xml, application/json – TaskDefinitionListDocument Role: _taskdefinition_write

Delete a custom job type

DELETE /task-definition/jobtype/(type) Deletes the job type with the specified name. This will only work for custom job types. System defined job types cannot be deleted. Status Codes: 404 – Custom job type with specified name not found. Role: _taskdefinition_write

Task definition scripts

Retrieve the script for a task definition

GET /task-definition/(task-id)/script GET /task-definition/jobtype/(type)/step/(step)/script Retrieves the script of the task definition. Produces: application/javascript – A JavaScript Status Codes: 204 – No script is set for the task definition. Role: _taskdefinition_read

Set a script for a shape tag

PUT /task-definition/(task-id)/script PUT /task-definition/jobtype/(type)/step/(step)/script Sets a script for the task definition. Accepts: application/javascript – A JavaScript Role: _taskdefinition_write

Job graphs

In order to easily see the dependencies between steps for a particular job type, there is functionality to render the job definition as a graph. In order to render the graph, the Graphviz package is required.

Get job graph

GET /task-definition/jobtype/(type)/graph Shows the dependencies of the tasks of a specified job type. Produces: image/png – Role: _administrator

Get job graph as DOT file

GET /task-definition/jobtype/(type)/graph/dot Shows the dependencies of the tasks of a specified job type in DOT format, for further processing. Produces: text/plain, text/vnd.graphviz – Role: _administrator