Tolls endpoint
How to get toll costs and informations for an origin and destination pair.
- Required parameters
- Optional parameters
- Traffic awareness parameters (optional)
- Response
- Tolls endpoint server side
- Usage limits
All toll data is coming from Here Service
Get Toll costs, Toll details, distance, duration and path (as a polyline) between an origin and a destination, based on the recommended route between those two points by car. This endpoint provides you all the information needed to get tolls pricing and details for an itinerary.
Requests should be built as follows:
https://api.woosmap.com/distance/tolls/json?parameters
To benefit from toll costs data, you must enable the “Distance with tolls” addon via the Woosmap Console on you project.
Required parameters
Some parameters are required to initiate a Distance Route API with Toll Costs request. As it is standard in URLs, all parameters are separated using the ampersand (&) character. The list of parameters and their possible values are enumerated below.
https://api.woosmap.com/distance/tolls/json?destination=47.852954,2.290887&origin=49.850077,4.311124&key={PUBLIC_API_KEY}
origin
The starting point for the route. It should be supplied in the form of latitude/longitude coordinates. Ensure that no space exists between the latitude and longitude values.
destination
The ending point for the route. It should be supplied in the form of latitude/longitude coordinates. Ensure that no space exists between the latitude and longitude values.
key
Your project’s API key. This key identifies your Woosmap Project for purposes of quota management. (you should use key client side and private_key server side)
Please refer to the documentation to get an API Key if necessary
Optional parameters
https://api.woosmap.com/distance/tolls/json?origin=49.850077,4.311124&destination=47.852954,2.290887&mode=driving&language=ru&units=imperial&alternatives=true&details=full&key={PUBLIC_API_KEY}
language
The language code, indicating in which language the results should be returned, if possible. If language is not supplied, the Distance API service will use the navigator language or “en”.
units
Specifies the unit system to use when expressing distance as text. Two different units supported: metric
(default) returns distances in kilometers and meters, imperial
returns distances in miles and feet.
alternatives
Specifies if alternative routes should be returned. Valid values are true
and false
(default is false
). Depending on the calculated route, alternatives may not be provided.
The routes are sorted by time or duration depending on the method
parameter ( default is duration ).
There is no recommended: true
value in the response with the /tolls
endpoint.
waypoints
A list of points by which the route should pass (route response is divided into legs, one leg corresponding to a route between two waypoints). Waypoints should be separated by |
character.
optimize:true
parameter is not supported on the /tolls
endpoint
example : waypoints=48.850077,3.311124|48.850077,3.411124
alternatives
and waypoints
can not be used at the same time.
method
Specifies the method to compute the route between the start point and the end point:
time
: fastest route (default)distance
: shortest route
Traffic awareness parameters (optional)
To get route calculation taking into account live traffic conditions, historical traffic patterns, or time-dependent restrictions, you can either use the departure_time
or arrival_time
parameters.
departure_time
Specifies the date/time at which to base the calculations on for traffic purposes.
Valid values are a unix timestamp
or the word now
.
e.g. 22/09/2020 20:26:13 ==> 1600799173
Use either arrival_time
or departure_time
, not both.
By using this parameter, duration is calculated taking into account the traffic
arrival_time
Specifies the date/time at which to base the calculations on for traffic purposes.
Valid values are unix timestamp
.
e.g. 22/09/2020 20:26:13 ==> 1600799173
Use either arrival_time
or departure_time
, not both.
By using this parameter, duration is calculated taking into account the traffic
To benefit from traffic data and toll costs, you must enable both “Distance with traffic” and “Distance with Tolls” addons via the Woosmap Console on your project.
Response
Route provides a JSON response containing the following root elements:
status contains metadata on the request.
routes contains an array of route
, which in turn contains an overview_polyline
, bounds
and legs
.
Each leg
contains a tolls
and tollSystems
section with all data related to tolls.
The /tolls endpoint of Distance API is mostly based on the Here Routing API with Tolls.
The tolls
and tollSystems
sections of the response are directly inherited from Here API content and format.
Woosmap Distance with Tolls addon has been incorporated to the Woosmap platform to ease and speed-up integrations and help customers cover itinerary use cases expecting toll cost calculations. More details on coverage information are available here.
Tolls endpoint server side
As for other Woosmap APIs, if you plan to use the Tolls endpoint of Distance API sever side you must use a private_key in your requests.
.../distance/tolls/json?origin=48.836,2.237&destination=48.709,2.403&private_key=[Private APIKey]&language=en&units=metrics
Usage limits
The following usage limits are in place for the Tolls endpoint of Distance API:
- Maximum of 5 queries per second (QPS) per Project (so possibly the sum of client-side and server-side queries)
- Max distance between origin and destination should not exceed 500km.