Whenever the result of an action can't be returned synchronously, the api creates a task that will manage the lifecycle of the asynchronous process. The URL of this task will be returned into the header Content-Location and the body will contain its representation.
The client can use that URL to obtain the status of the process, if the task is still in progress or has failed the response will contain the task representation again but if the process has finished the server will response with the status code 303 (See Other) and the Location header will contain the URL of the process' result.
Task Data Model
| Field Name | Type | Occurs | Required | Description |
|---|---|---|---|---|
| status | Enumeration | 1 | true | The current status of the task. Possible values: pending, finished, failed |
| expiresAt | date-time | 1 | false | when that task expires and it won't be available anymore |
| error | Element | 1 | false | element that contains information when an error happen |
| uri | Link | 1 | true | link to itself |
| cancel | Link | 1 | false | link to cancel the task |
Method related with tasks
Create a task
figuring out we can deploy virtual appliances:
Synopsis: POST http://example.com/api/cloud/vapps/{$vappId}/action/deploy
Request Headers: Accept, Content-Type.
Request Parameters: N/A.
Request Message Body: N/A.
Example Request: Deploy a virtual appliance
Response Headers: Content-Type, Location.
Response Message Body: None.
Response Status: 202, 401, 403.
Example Response: Response of the POST Deploy a virtual appliance
Retrieve a finished task
Synopsis: GET http://example.com/api/cloud/tasks/{$taskId}
Request Headers: Accept
Request Parameters: N/A.
Request Message Body: N/A.
Example Request: Retrieve a finished task
Response Headers: Content-location, Expires.
Response Message Body: None.
Response Status: 200, 303, 401, 403.
Example Response: Response of the retrieve a finished task
Retrieve a pending task
Synopsis: GET http://example.com/api/cloud/tasks/{$taskId}
Request Headers: Accept
Request Parameters: N/A.
Request Message Body: N/A.
Example Request: Retrieve a pending task
Response Headers: Content-Type.
Response Message Body: None.
Response Status: 200, 303, 401, 403.
Example Response: Response of the retrieve a pending task
Retrieve a failed task
Synopsis: GET http://example.com/api/cloud/tasks/{$taskId}
Request Headers: Accept
Request Parameters: N/A.
Request Message Body: N/A.
Example Request: Retrieve a failed task
Response Headers: Content-Type.
Response Message Body: None.
Response Status: 200, 303, 401, 403.
Example Response: Response of the retrieve a failed task

