Polling Task Status
GET
https://routecloud.telogis.com/v1/tasks/{task_id}.- Authentication required.
- Response body: task_status_response.
The /tasks/{task_id}
call returns the current status of a given task_id
.
URL Parameters
{task_id}
- The id of the task that the result is retrieve from.
Query Parameters
after={timestamp}
- Optional. The minimum time, in UTC, before a status is returned (unless the task finishes earlier). Timestamps should be provided in ISO 8601 format.cancel_on_disconnect=1
- Optional. If the client disconnects, cancel the task. Only applies ifafter
is specified.
Status Codes
200
- Success.302
- If no status messages are available that satisfy theafter
parameter, a redirect is sent instead of a normal status every 15 seconds to refresh the HTTP timeout.401
- Authentication required.404
- Thetask_id
does not exist, or the current user does not have permission to access it.
Example
GET https://routecloud.telogis.com/v1/tasks/v4AQjZm1eUW0gFnECtxqAw HTTP/1.1
X-Telogis-Session-Id: e938d41c-d519-4f07-b0a9-26d4745d6e74
Accept: application/json
While the task is still in progress:
HTTP/1.1 200 OK
Content-Type: application/json
{
"task_id": "v4AQjZm1eUW0gFnECtxqAw",
"status": "running",
"started_at": "2016-02-10T08:30:37.7998820Z",
"last_status_time": "2016-02-10T08:30:38.398345Z"
}
Once the task is completed:
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": "v4AQjZm1eUW0gFnECtxqAw",
"status": "completed",
"started_at": "2016-02-10T08:30:37.7998820Z",
"finished_at": "2016-02-10T08:32:13.9611716Z",
"last_status_time": "2016-02-10T08:32:13.9611716Z"
}
Using the after
Parameter
If the after
parameter is provided, the RouteCloud API waits for a status to be posted after this time before responding to the request.
For example, after
can be set to the time of the last received status update. This ensures that the same update is not returned again.
If the task finishes, fails, or is canceled before the specified time, the RouteCloud API immediately responds with a completion status.
Example
GET https://routecloud.telogis.com/v1/tasks/v4AQjZm1eUW0gFnECtxqAw?after=2016-02-10T08:30:40 HTTP/1.1
X-Telogis-Session-Id: e938d41c-d519-4f07-b0a9-26d4745d6e74
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
{
"task_id": "v4AQjZm1eUW0gFnECtxqAw",
"status": "running",
"started_at": "2016-02-10T08:30:37.7998820Z",
"last_status_time": "2016-02-10T08:30:41.002134Z"
}