Analysis Partial Histogram Result

Service version: 1
Last edit: 2022.07.25

Purpose

Get a partial histogram result by sending a POST request.

Request data

Format

POST
URL request example
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/{id}/result/partial/histogram?key={apiKey}&dateRange={dateRange}&timeRange={timeRange}&type={type}

Example

POST
URL request example
https://api.tomtom.com/origindestination/1/analysis/flowmatrix/123/result/partial/histogram?key=test-api-key&dateRange=0&timeRange=0&type=HOURS_OF_DAY

Required POST Headers

HeaderValue
Content-Typeapplication/json

Parameters

ParameterDescription
apiKeyAuthorization key for access to the API.
dateRangeIndex of the date range.
timeRangeIndex of the time range.
typeType of the histogram. One of the following values:
  • HOURS_OF_DAY - hour of day when trips started
  • LENGTHS - trips lengths in kilometers
  • DURATIONS - trips durations in minutes with 20 minutes interval

Request body stucture

FieldDescription
originsList of regions' indexes where trips started.
destinationsList of regions' indexes where trips ended.
viasList of regions' indexes where trips went through.

Request body example

POST
Request body - JSON
1{
2 "origins": [0,1,2,3],
3 "destinations": [4,5,6,7,8],
4 "vias": [10]
5}

Response data

This response will return an array where each index is histogram’s bucket with information about the number of trips which started in a given origin, went through given vias, and ended in given destinations. The array size depends on the histogram type you choose:

TypeSize of array
HOURS_OF_DAY24
DURATIONSNo limitation (contains all durations buckets for minimal interval of 5 minutes).
LENGHTSNo limitation (contains all length buckets for minimal interval of 1 kilometer).

Response structure

A sample response for an HOURS_OF_DAY histogram contains the following data. Each value of histogram pairs is a number of trips which started in given origins, went through given vias, and ended in given destinations for the given hour.

Result interpretation example

POST
Response body - JSON
1{
2 "bucketInterval": 1,
3 "unit": "HOUR",
4 "histogram": {
5 "4": 6,
6 "5": 15,
7 "6": 52,
8 "7": 148,
9 "8": 568,
10 "9": 10766,
11 "10": 39039,
12 "11": 41573,
13 "12": 44617,
14 "13": 44866,
15 "14": 44537,
16 "15": 48869,
17 "16": 49014,
18 "17": 48767,
19 "18": 47713,
20 "19": 40060
21 }
22}

Errors

If there is an error in the supplied parameters or any other internal problem, an error response is generated in the requested format.

HTTP Response Codes

CodeReason
201Created
400Bad request
401Unauthorized
403Forbidden
404Not Found