Get Shortest Route
Implement Using: Directions Flexible API
When the business requirements are such that a shortest route between 2 places is most desirable, users can make use of the route_type parameter of Directions Flexible API to generate a route with least traveling distance. To configure the request for this example we add:
origin&destinationto to denote the starting and end locations of the tripmodeset to “car” to get a route which a car can takeroute_typeparameter set to “shortest”optionset to “flexible”
Request
Response
Following is a visual representation of the above route on a map. We can observe that the highway route which could have been faster but lengthier, is avoided because of the “route_type” setting.
