# TaskService

Manages tasks on the Deployit Server.

GET | /task/current | Returns the active tasks of the logged in user.
GET | /task/current/all | Returns all active tasks for all users.
GET | /task/export | Searches for tasks with detailed step information.
GET | /task/query | Searches for tasks without step information.
GET | /task/{taskid} | Returns a task by ID.
DELETE | /task/{taskid} | Cancels a stopped task.
POST | /task/{taskid}/abort | Aborts an active task.
POST | /task/{taskid}/archive | Archive an executed task.
POST | /task/{taskid}/assign/{owner} | Assigns a task to a different user.
POST | /task/{taskid}/move/{stepId}/{position} | Moves a step.
POST | /task/{taskid}/pause/{stepId} | Add a pause step at the specified position.
POST | /task/{taskid}/skip | Indicates that one or more steps should be skipped.
POST | /task/{taskid}/start | Starts a task.
GET | /task/{taskid}/step | Returns a task containing step information.
GET | /task/{taskid}/step/{stepId} | Retrieves information about a step.
POST | /task/{taskid}/stop | Gracefully stops an active task.
POST | /task/{taskid}/takeover/{owner} | Takeover a task from the owner.
POST | /task/{taskid}/unskip | Indicates that one or more steps should no longer be skipped, but executed.

## GET /task/current

Returns the active tasks of the logged in user.

Response body
  List of TaskState - a list of tasks.
  Content type: application/xml, application/json

## GET /task/current/all

Returns all active tasks for all users. Only allowed for admin.

Response body
  List of TaskState - a list of tasks.
  Content type: application/xml, application/json

## GET /task/export

Searches for tasks with detailed step information.

Parameters

  Query | begindate | LocalDate | The first day we want to see tasks from, or `null` for no such limit.
  Query | enddate | LocalDate | The last day we want to see tasks from, or `null` for no such limit.

Response body
  List of TaskWithSteps - a list of tasks with step information.
  Content type: application/xml, application/json

## GET /task/query

Searches for tasks without step information.

Parameters

  Query | begindate | LocalDate | The first day we want to see tasks from, or `null` for no such limit.
  Query | enddate | LocalDate | The last day we want to see tasks from, or `null` for no such limit.

Response body
  List of TaskState - a list of tasks.
  Content type: application/xml, application/json

## GET /task/{taskid}

Returns a task by ID.

Parameters

  Path | taskid | String | the ID of the task

Response body
  TaskState - the task.
  Content type: application/xml, application/json

## DELETE /task/{taskid}

Cancels a stopped task.

Parameters

  Path | taskid | String | the ID of the task

Response body
  Empty

## POST /task/{taskid}/abort

Aborts an active task.

Parameters

  Path | taskid | String | the ID of the task

Response body
  Empty

## POST /task/{taskid}/archive

Archive an executed task.

Parameters

  Path | taskid | String | the ID of the task

Response body
  Empty

## POST /task/{taskid}/assign/{owner}

Assigns a task to a different user.

Permissions
  `task#assign`

Parameters

  Path | taskid | String | the ID of the task
  Path | owner | String | the name of the user that will be the new owner of the task.

Response body
  TaskState - the task.
  Content type: application/xml, application/json

## POST /task/{taskid}/move/{stepId}/{position}

Moves a step.

Permissions
  `task#move_step`

Parameters

  Path | taskid | String | the ID of the task
  Path | stepId | int | the current position of the step in the step list.
  Path | position | int | the new position of the step in the step list.

Response body
  TaskWithSteps - a task with full step information.
  Content type: application/xml, application/json

## POST /task/{taskid}/pause/{stepId}

Add a pause step at the specified position.

Parameters

  Path | taskid | String | the ID of the task
  Path | stepId | int | the position of the step in the step list.

Response body
  TaskWithSteps - a task with full step information.
  Content type: application/xml, application/json

## POST /task/{taskid}/skip

Indicates that one or more steps should be skipped.

Permissions
  `task#skip_step`

Parameters

  Path | taskid | String | the ID of the task
  Request body | application/xml, application/json | List of Integer | the IDs of the steps to skip

Response body
  TaskWithSteps - a task with full step information.
  Content type: application/xml, application/json

## POST /task/{taskid}/start

Starts a task.

Parameters

  Path | taskid | String | the ID of the task

Response body
  Empty

## GET /task/{taskid}/step

Returns a task containing step information.

Parameters

  Path | taskid | String | the ID of the task

Response body
  TaskWithSteps - a task with full step information.
  Content type: application/xml, application/json

## GET /task/{taskid}/step/{stepId}

Retrieves information about a step.

Parameters

  Path | taskid | String | the ID of the task
  Path | stepId | int | the ordinal number of the step, starting from 1
  Header | If-Modified-Since | DateTime | the if-modified-since date in RFC 1123 (RFC 822 with 4-digit years) date format.

Response body
  StepState - if the step has not been modified since `ifModifiedSince` , a response with status code of 304 (Not Modified), otherwise a response with a status code of 200 (OK) and XML containing a StepState.
  Content type: application/xml, application/json

## POST /task/{taskid}/stop

Gracefully stops an active task.

Parameters

  Path | taskid | String | the ID of the task

Response body
  Empty

## POST /task/{taskid}/takeover/{owner}

Takeover a task from the owner. This will re-assign the task to your logged in user. This is the reverse of the #assign(String, String) method, which allows you to re-assign a task.

Permissions
  `task#takeover`

Parameters

  Path | taskid | String | the ID of the task to take over
  Path | owner | String | the current owner of the task

Response body
  TaskState - the task you took over.
  Content type: application/xml, application/json

## POST /task/{taskid}/unskip

Indicates that one or more steps should no longer be skipped, but executed.

Permissions
  `task#skip_step`

Parameters

  Path | taskid | String | the ID of the task
  Request body | application/xml, application/json | List of Integer | the IDs of the steps to unskip

Response body
  TaskWithSteps - a task with full step information.
  Content type: application/xml, application/json