Asynchronous Snap to Roads Download
Purpose
This endpoint lets clients download the result of the Asynchronous Snap To Roads Submission. A unique batch id is required to download the Asynchronous Snap To Roads Submission request result. This id is available inside the body of a successful Asynchronous Snap To Roads Submission response. To download the result the job must be in the Completed
state.
The current state of a job may be checked using the Asynchronous Snap To Roads Status endpoint. The result of a completed job will be included in the HTTP 200
response body. A result download request for a non-completed job will end with an HTTP 404
response.
Run this endpoint
You can easily run this and other endpoints. Go to the TomTom API Explorer page and follow the directions.
Request data
HTTPS method: GET
For ease of viewing and identification:
- Constants and parameters enclosed in curly brackets { } must be replaced with their values.
- Please see the following Request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.
https://{baseURL}/snapToRoads/batch/{versionNumber}/{batchID}?key={Your_API_Key}
https://api.tomtom.com/snapToRoads/batch/1/b4086eb3-dead-beef-afbf-cc521fe1d9d8?key={Your_API_Key}
curl -X GET 'https://api.tomtom.com/snapToRoads/batch/1/b4086eb3-dead-beef-afbf-cc521fe1d9d8?key={Your_API_Key}'
Request parameters
The following table describes the parameters that can be used in a request.
- Required parameters must be used or the call will fail.
- Parameters and values are case-sensitive.
- Optional parameters may be used.
Note: There are no optional parameters in this endpoint.
Required parameters | Description |
---|---|
| The base URL for calling TomTom services. |
| The version of the service to call. |
| A unique batch id is available inside the body of a successful Asynchronous Snap To Roads Submission response. |
| The authorization key for access to the API. |
HTTP request headers
The following table lists HTTP request headers of particular interest to clients of the Asynchronous Snap to Roads Download endpoint.
Note: There are no required headers in this endpoint.
Optional headers | Description |
---|---|
Contains the content encoding (usually a compression algorithm), that
the client is able to understand. | |
Tracking-ID | Specifies an identifier for the request.
Value: |
Response data
Snap To Roads Download response schema
An exclamation mark !
means that the field is not nullable. For example:
String!
- is non-nullable[String!]
- list of non-null objects[String]!
- list cannot be null, but it can contain null values
1type BatchResponse {2 batchItems: [SnapToRoadsBatchItemResponse!]!3}45type SnapToRoadsBatchItemResponse {6 statusCode: Int!7 response: SnapToRoadsResponse!8}910type SnapToRoadsResponse {11 refer to Query type at https://developer.tomtom.com/snap-roads-api/snap-roads-documentation/synchronous-snap-roads#response-data12}
Response field structure
The following tables describe JSON element fields that can appear in a response.
Structure of the BatchResponse object | |
---|---|
Field | Description |
| An array containing all reconstructed routes provided previously by Submission endpoint. |
Structure of the SnapToRoadsBatchItemResponse object | |
---|---|
Field | Description |
| HTTP response code of a request |
| Snap To Roads response for a given request |
Successful response
For a valid Asynchronous Snap To Roads Download request, the endpoint returns its response body in JSON format.
Successful response body example - JSON
1{2 "batchItems": [3 {4 "statusCode": 200,5 "response": {6 "projectedPoints": [7 {8 "geometry": {9 "coordinates": [19.4389, 51.7806],10 "type": "Point"11 },12 "properties": {13 "routeIndex": 014 },15 "type": "Feature"16 },17 {18 "geometry": {19 "coordinates": [19.4393, 51.7806],20 "type": "Point"21 },22 "properties": {23 "routeIndex": 124 },25 "type": "Feature"26 },27 {28 "geometry": {29 "coordinates": [19.4396, 51.7806],30 "type": "Point"31 },32 "properties": {33 "routeIndex": 234 },35 "type": "Feature"36 },37 {38 "geometry": {39 "coordinates": [19.4401, 51.7807],40 "type": "Point"41 },42 "properties": {43 "routeIndex": 244 },45 "type": "Feature"46 }47 ],48 "route": [49 {50 "geometry": {51 "coordinates": [52 [19.4389, 51.7806],53 [19.4391, 51.7806],54 [19.4392, 51.7806]55 ],56 "type": "LineString"57 },58 "properties": {59 "address": {60 "countryCode": "POL",61 "countryName": "Polska",62 "countrySubdivision": "Łódzkie",63 "municipality": "Łódź",64 "roadName": "Drewnowska",65 "roadNumbers": []66 },67 "formOfWay": "SingleCarriageway",68 "frc": 5,69 "id": "e1e14e9d-9b17-4dfb-a94d-41484d61e8dc",70 "laneInfo": {71 "numberOfLanes": 472 },73 "roadUse": "LocalStreet",74 "speedLimits": {75 "unit": "kmph",76 "value": 5077 }78 },79 "type": "Feature"80 },81 {82 "geometry": {83 "coordinates": [84 [19.4392, 51.7806],85 [19.4393, 51.7806],86 [19.4394, 51.7806],87 [19.4396, 51.7806]88 ],89 "type": "LineString"90 },91 "properties": {92 "address": {93 "countryCode": "POL",94 "countryName": "Polska",95 "countrySubdivision": "Łódzkie",96 "municipality": "Łódź",97 "roadName": "Drewnowska",98 "roadNumbers": []99 },100 "formOfWay": "SingleCarriageway",101 "frc": 5,102 "id": "928bdb03-3ef9-4bc5-9ce1-419fb9d8d91a",103 "laneInfo": {104 "numberOfLanes": 4105 },106 "roadUse": "LocalStreet",107 "speedLimits": {108 "unit": "kmph",109 "value": 50110 }111 },112 "type": "Feature"113 },114 {115 "geometry": {116 "coordinates": [117 [19.4396, 51.7806],118 [19.4401, 51.7807]119 ],120 "type": "LineString"121 },122 "properties": {123 "address": {124 "countryCode": "POL",125 "countryName": "Polska",126 "countrySubdivision": "Łódzkie",127 "municipality": "Łódź",128 "roadName": "Drewnowska",129 "roadNumbers": []130 },131 "formOfWay": "SingleCarriageway",132 "frc": 5,133 "id": "d42c1de3-1ab7-49d2-aaf6-6076427362be",134 "laneInfo": {135 "numberOfLanes": 4136 },137 "roadUse": "LocalStreet",138 "speedLimits": {139 "unit": "kmph",140 "value": 50141 }142 },143 "type": "Feature"144 }145 ]146 }147 }148 ]149}
Error response
The Asynchronous Snap to Roads Download endpoint for an invalid single request returns a response body in JSON format.
Field | Description |
---|---|
| Main |
| One of a server-defined set of error codes. |
| A human-readable description of the error code. |
1{2 "detailedError": {3 "code": "INVALID_REQUEST",4 "message": "Batch not found."5 }6}
HTTP response codes
Code | Meaning & possible causes |
---|---|
| OK |
| Bad request |
| Forbidden: The supplied API Key is not valid for this request. |
| Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource. |
| Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key. |
| Internal Server Error |
| Service currently unavailable: The service is currently unavailable. |
| Service Not Found: Unknown version of the service. |
HTTP response headers
The following data table lists HTTP response headers of particular interest to clients of the Asynchronous Snap to Roads Download endpoint.
Header | Description |
---|---|
Indicates that cross-origin resource sharing (CORS) is allowed. | |
Lists the set of supported HTTP methods. The header is sent in case a
| |
Indicates which encodings were applied to the response body. | |
Contains information about the size of the response body. | |
Indicates the media type of the resource returned. | |
Contains the date and time at which the message was originated. For
details check
RFC 7231. | |
Tracking-ID | An identifier for the request.
Value: |