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.
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).
| Status | Description |
|---|---|
| 200 - OK | Returned if the request was completed successfully. |
| 404 - NotFound | Returned if no job was found with the sepcified identifier. |
Example of retrieving the progress status for a task that is running in the background.
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Request Parameters
| Key | Value | Description |
|---|---|---|
| {id} | reindex-7bdba522-590a-4df4-b409-a2939851241b | The Unique identifier of the job (string). |
Response Headers
| Key | Value | Description |
|---|---|---|
| Content-Type | application/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 of retrieving the progress for a task that has finished.
Request Headers
| Key | Value | Description |
|---|---|---|
| Accept | application/json |
Request Parameters
| Key | Value | Description |
|---|---|---|
| {id} | reindex-7bdba522-590a-4df4-b409-a2939851241b | Unique identifier of the job (string) |
Response Headers
| Key | Value | Description |
|---|---|---|
| Content-Type | application/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