Analysis Creation
Purpose
Create a Selected Link Analysis by sending a POST request.
Request data
HTTPS Method: POST
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.
Format
https:/{baseURL}/origindestination/{versionNumber}/analysis/selected-link?key={Your_API_Key}
Example
https://api.tomtom.com/origindestination/1/analysis/selected-link?key={Your_API_Key}
Request parameters
Required parameters | Description |
---|---|
| The base URL for calling TomTom services. Value: |
| Version of the service to call. Value: The current value is |
| Authorization key for access to the API. Value: Your valid API Key. |
Request POST body structure
Required fields | Description |
---|---|
| Job name string which will be used in the process and output. Given for the user’s convenience. |
| GeoJSON LineString is the correct definition of a link. (Limit: Maximum length of a link is 10 km.) |
| Determines from what devices data will be used.
|
| Time definition for the analysis. |
| Time zone for the analysis as a TZ database name. For example "Europe/Amsterdam" or "UTC". |
| Days of the week to analyse. Allowed values:
|
| List of date ranges to analyze. Date ranges must start not earlier than two years in the past and not end in the future. (Limits: 4 date ranges, each date range having no more than 365/366 days.) |
| List of time ranges to analyse (Limit: 24 time ranges). |
Optional fields | Description |
---|---|
| Optional parameter telling what map version should be used for map matching. If not used, we will pick a map version for you based on the selected date ranges. You can check the list of available maps at Available Maps. The value of this parameter should be correlated with the used date range in order to avoid confusion. |
| What map type should be used. There are two possible options:
For details what types are currently available, please refer to Available Maps. |
| Radius of the analyzed area. Accepts values starting from 5 000 (5km) to 50 000 (50km). If not specified default value of 10 000 (10km) will be used. |
Required POST headers
Header | Value |
---|---|
|
Request POST body example
1{2 "name": "Selected Link Example",3 "time": {4 "dateRanges": [5 {6 "startDate": "2024-01-01",7 "endDate": "2024-01-06"8 },9 {10 "startDate": "2024-02-01",11 "endDate": "2024-02-06"12 },13 {14 "startDate": "2024-02-05",15 "endDate": "2024-02-06",16 "name": "weekend"17 }18 ],19 "daysOfWeek": [20 "MONDAY",21 "TUESDAY",22 "WEDNESDAY",23 "THURSDAY",24 "FRIDAY",25 "SATURDAY",26 "SUNDAY"27 ],28 "timeRanges": [29 {30 "startTime": "08:00",31 "endTime": "12:00"32 },33 {34 "startTime": "15:00",35 "endTime": "19:00"36 }37 ],38 "zoneId": "Europe/Warsaw"39 },40 "link": {41 "type": "LineString",42 "coordinates": [43 [21.02143, 52.24896],44 [21.02401, 52.25008]45 ]46 },47 "map": {48 "version": "2024.06",49 "type": "DSEG_NOSPLIT"50 }51}
All date ranges and all time ranges are multiplied to cover all possible time definitions. For the preceding example this will result in 4 different periods:
2024-01-01 - 2024-01-06 : 08:00 - 12:00
2024-01-01 - 2024-01-06 : 15:00 - 19:00
2024-02-01 - 2024-02-06 : 08:00 - 12:00
2024-02-01 - 2024-02-06 : 15:00 - 19:00
Date range format
Required fields | Description |
---|---|
| Start date of the date range in |
| End date of the date range in |
Optional fields | Description |
---|---|
| List of dates to exclude from the given range in |
| Date range name. Given for the user's convenience. Value: A date range name. For example: "Last working week of January". |
Time range format
Field | Description |
---|---|
| Start time of the time range in |
| End time of the time range in |
NOTE: To analyse a whole day you should use 00:00 for both the startTime and endTime.
Response data
This response will return information about the created analysis. The following table describes all of the fields that can appear in a response.
Response structure
Field | Description |
---|---|
| Analysis number id. |
| Job name, given for the user’s convenience. |
| Email or API Key of the analysis' owner. |
| API Key of the analysis' owner. |
| Job status. One of the following values:
|
| Current value of the job progress (0-100). |
| Job creation time in |
| Time definition of the analysis. |
| Time zone as a TZ database name. For example "Europe/Amsterdam" or "UTC". |
| Days of the week of the analysis. Allowed values:
|
| List of date ranges of the analysis. |
| List of time ranges of the analysis. |
| How many trips were counted. Updates when the analysis is in progress. |
| Date and time start of the analysis in format:
|
| Date and time end of the analysis in format:
|
Errors
If there is an error in the supplied parameters or any other internal problem, an error response is generated in the requested format.
Response codes
Code | Meaning & possible causes |
---|---|
| Created |
| Bad Request |
| Unauthorized |
| Forbidden |
| Not Found |