RouteGetRouteDirectionsBatch202Response interface
The Get Route Directions Batch
API is an HTTP GET
request that sends batches of queries to the Get Route Directions API using a single request. You can call Get Route Directions Batch
API to run either asynchronously (async) or synchronously (sync). The async API allows caller to batch up to 700 queries and sync API up to 100 queries.
Download Asynchronous Batch Results
To download the async batch results you will issue a GET
request to the batch download endpoint. This download URL can be obtained from the Location
header of a successful POST
batch request and looks like the following:
https://atlas.microsoft.com/route/directions/batch/{batch-id}?api-version=1.0&subscription-key={subscription-key}
Here's the typical sequence of operations for downloading the batch results:
Client sends a
GET
request using the download URL.The server will respond with one of the following:
HTTP
202 Accepted
- Batch request was accepted but is still being processed. Please try again in some time.HTTP
200 OK
- Batch request successfully processed. The response body contains all the batch results.
Batch Response Model
The returned data content is similar for async and sync requests. When downloading the results of an async batch request, if the batch has finished processing, the response body contains the batch response. This batch response contains a summary
component that indicates the totalRequests
that were part of the original batch request and successfulRequests
i.e. queries which were executed successfully. The batch response also includes a batchItems
array which contains a response for each and every query in the batch request. The batchItems
will contain the results in the exact same order the original queries were sent in the batch request. Each item in batchItems
contains statusCode
and response
fields. Each response
in batchItems
is of one of the following types:
RouteDirections
- If the query completed successfully.Error
- If the query failed. The response will contain acode
and amessage
in this case.
Here's a sample Batch Response with 1 successful and 1 failed result:
{
"summary": {
"successfulRequests": 1,
"totalRequests": 2
},
"batchItems": [
{
"statusCode": 200,
"response": {
"routes": [
{
"summary": {
"lengthInMeters": 1758,
"travelTimeInSeconds": 387,
"trafficDelayInSeconds": 0,
"departureTime": "2018-07-17T00:49:56+00:00",
"arrivalTime": "2018-07-17T00:56:22+00:00"
},
"legs": [
{
"summary": {
"lengthInMeters": 1758,
"travelTimeInSeconds": 387,
"trafficDelayInSeconds": 0,
"departureTime": "2018-07-17T00:49:56+00:00",
"arrivalTime": "2018-07-17T00:56:22+00:00"
},
"points": [
{
"latitude": 47.62094,
"longitude": -122.34892
},
{
"latitude": 47.62094,
"longitude": -122.3485
},
{
"latitude": 47.62095,
"longitude": -122.3476
}
]
}
],
"sections": [
{
"startPointIndex": 0,
"endPointIndex": 40,
"sectionType": "TRAVEL_MODE",
"travelMode": "bicycle"
}
]
}
]
}
},
{
"statusCode": 400,
"response":
{
"error":
{
"code": "400 BadRequest",
"message": "Bad request: one or more parameters were incorrectly specified or are mutually exclusive."
}
}
}
]
}
- Extends
Properties
headers | |
status |
Inherited Properties
body | Parsed body |
request | The request that generated this response. |
Property Details
headers
headers: RawHttpHeaders & RouteGetRouteDirectionsBatch202Headers
Property Value
status
status: "202"
Property Value
"202"
Inherited Property Details
body
Parsed body
body: unknown
Property Value
unknown
Inherited From HttpResponse.body
request
The request that generated this response.
request: PipelineRequest
Property Value
Inherited From HttpResponse.request
Azure SDK for JavaScript