diff --git a/execution/asynchronous-tasks.md b/execution/asynchronous-tasks.md index 83e92c6..7ff9e95 100644 --- a/execution/asynchronous-tasks.md +++ b/execution/asynchronous-tasks.md @@ -1,2 +1,20 @@ # Asynchronous Tasks -If an API operation is asynchronous, but its progress could be tracked by a client the response to such an operation MUST return the +If an API operation is asynchronous, but its progress could be tracked by a client, the response to such an asynchronous operation **MUST** return, in the case of success, the **202 Accepted** status code together with a `application/hal+json` representation of a new task-tracking resource. + + +## Task Resource +The task resource **SHOULD** convey the information about the status of the asynchronous task. + +Retrieval of such a resource using the HTTP GET Request Method **SHOULD** be designed as follows: + +1. Task is Still Processing + + Return **200 OK** and representation of the current status. + +2. Task Successfully Completed + + Return **303 See Other** together with [HTTP Location Header](https://tools.ietf.org/html/rfc7231#section-7.1.2) with URI or a outcome resource. + +3. Task Failed + + Return **200 OK** and `application/problem+json` with the problem detail information on the task has failed.