Get Fastest Routes
Products Used: Directions API & Navigation API
NextBillion.ai’s routing APIs offer the feature to select the type of route, namely fastest and shortest, to be suggested by the services. We can use the “route_type” attribute available in Directions and Navigation Flexible APIs to get the fastest possible route between 2 locations along with other details about the route.
Following is a Directions flexible request to get the shortest route with following configurations:
- An “origin” and “destination” for the trip
- “mode” option set to “car”
- “option” attribute set to “flexible”
- “route_type” option set to “fastest”
Directions API request
Directions API response
Notice that if the “route_type” is changed to “fastest” then, although the trip duration is lesser than what is suggested in case of “shortest” route type setting, the distance is greater as compared to this case.
Navigation API request
Let’s take a look at how a Navigation API call would look like for the exact same parameters as the above example.
Navigation API response
Visit Directions API | Navigation API documentation to know more about the available features.