Resource: Background Task ( /api/backgroundtask/{id} )

The Background Task resource allows you to retrieve the details of a currently executed or completed task. This includes information related to the progress (% completed) of the task.

Tasks available include: 

  • CreateTicketLink
  • DeleteOrganisation
  • DeleteProject
  • GenerateTestProject
  • LinkTicketToAgileRunStep
  • LinkTicketToAutomatedTestRunResultNode
  • LinkTicketToStepResult
  • PerformanceTest
  • Reindex

This resource supports the following methods: GET

 

Methods

GET


Retrieves the status of a running or completed job. Note that after some time completed jobs will be flushed. At this point, this method will return a '404 Not Found' response.

Required Permissions

  • Enforced by task implementation

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.
404 - NotFoundReturned if no job was found with the specified identifier.

 

Example - In Progress Task

 

Example of retrieving the progress status for a task that is running in the background.

Request Headers

KeyValueDescription
Acceptapplication/json 

Request Parameters

KeyValueDescription
{id}reindex-7bdba522-590a-4df4-b409-a2939851241bThe Unique identifier of the job (string).

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8 

Response Body

{
  "Complete": false,
  "TotalElements": 10,
  "ProcessedElements": 5,
  "StartedAt": "2011-12-31T11:00:00Z",
  "ProgressInPercent": 0.5,
  "Id": "reindex-7bdba522-590a-4df4-b409-a2939851241b",
  "Message": "Reticulating Splines",
  "Self": "http://localhost/api/backgroundtask/reindex-7bdba522-590a-4df4-b409-a2939851241b"
}

Status Code

200 - OK

 

Example - Completed Task

 

Example of retrieving the progress for a task that has finished.

Request Headers

KeyValueDescription
Acceptapplication/json 

Request Parameters

KeyValueDescription
{id}reindex-7bdba522-590a-4df4-b409-a2939851241bUnique identifier of the job (string)

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8 

Response Body

{
  "Complete": true,
  "TotalElements": 10,
  "ProcessedElements": 10,
  "StartedAt": "2011-12-31T12:00:00Z",
  "FinishedAt": "2011-12-31T12:10:14Z",
  "ProgressInPercent": 1.0,
  "Id": "reindex-7bdba522-590a-4df4-b409-a2939851241b",
  "Message": "Task Completed",
  "Self": "http://localhost/api/backgroundtask/reindex-7bdba522-590a-4df4-b409-a2939851241b"
}

Status Code

200 - OK

 

 

  • No labels