RouteRequestRouteDirectionsBatchSync408Response interface
The Post Route Directions Batch Sync API is an HTTP POST request that sends batches of queries to the Get Route Directions API using a single synchronous request. You can call 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. To call the Post Route Directions Batch API in a asynchronous request, see Post Route Directions Batch.
Submit Synchronous Batch Request
The Synchronous API is recommended for lightweight batch requests. When the service receives a request, it will respond as soon as the batch items are calculated and there will be no possibility to retrieve the results later. The Synchronous API will return a timeout error (a 408 response) if the request takes longer than 60 seconds. The number of batch items is limited to 100 for this API.
POST https://atlas.microsoft.com/route/directions/batch/sync/json?api-version=1.0&subscription-key={subscription-key}
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 successfulRequestsi.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 acodeand amessagein 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
Inherited Properties
| headers | The HTTP response headers. |
| request | The request that generated this response. |
Property Details
body
status
status: "408"
Property Value
"408"
Inherited Property Details
headers
The HTTP response headers.
headers: RawHttpHeaders
Property Value
Inherited From HttpResponse.headers
request
The request that generated this response.
request: PipelineRequest
Property Value
Inherited From HttpResponse.request