55 lines
1.3 KiB
Markdown
55 lines
1.3 KiB
Markdown
## Polling task status
|
|
|
|
When a task is executed with the task API your retrieve a code.
|
|
This code can be used to poll the status of an item task execution.
|
|
|
|
The response 'message' field can contain a string message based on the context.
|
|
|
|
#### Get a list task of status for a given item
|
|
> Request
|
|
```javascript
|
|
GET /api/v1/items/{code}/tasks/
|
|
```
|
|
|
|
> Response 200 OK
|
|
```javascript
|
|
[
|
|
{
|
|
"taskType": "string",
|
|
"code": "string",
|
|
"message": "string",
|
|
"state": "0, 1, 2 or 3", // Error, Ok, Scheduled, Processing
|
|
"started": "2020-03-20T11:13:20.568Z",
|
|
"finished": "2020-03-20T11:13:20.568Z"
|
|
},
|
|
{
|
|
"taskType": "string",
|
|
"code": "string",
|
|
"state": "Error, Ok, Scheduled, Processing",
|
|
}
|
|
]
|
|
```
|
|
Response 401 Not authenticated
|
|
Response 403 No READ permissions in parent item
|
|
Response 404 Parent Item not found
|
|
|
|
#### Get the status of a task for a given item and item task code
|
|
> Request
|
|
```javascript
|
|
GET /api/v1/items/{code}/tasks/{itemTaskCode}
|
|
```
|
|
|
|
> Response 200 OK
|
|
```javascript
|
|
{
|
|
"taskType": "string",
|
|
"code": "string",
|
|
"message": "string",
|
|
"state": "0, 1, 2 or 3", // Error, Ok, Scheduled, Processing
|
|
"started": "2020-03-20T11:13:20.568Z",
|
|
"finished": "2020-03-20T11:13:20.568Z"
|
|
}
|
|
```
|
|
Response 401 Not authenticated
|
|
Response 403 No READ permissions in parent item
|
|
Response 404 Parent Item not found |