My organization was using the Google Directions API for route optimization, but we migrated to the Routes API because initial documentation suggested it would allow us to optimize routes with 25+ waypoints.
Now it appears this functionality has been broken out into a separate “Route Optimization” API as of ~2 months ago. The Route Optimization API is quite new, and some of its internal documentation still throws a 404 error. I can’t find an example of what the header should look like in a REST POST request for this new API.
To use the Routes API your header looks like this:
-H 'Content-Type: application/json'
-H 'X-Goog-Api-Key: YOUR_API_KEY'
-H 'X-Goog-FieldMask: routes.optimizedIntermediateWaypointIndex'
'https://routes.googleapis.com/directions/v2:computeRoutes'
I couldn’t find a way to do the same for the new Route Optimization API. The only documentation was for OAuth/google cloud “projects”.
Do you need to use OAuth to submit POST requests to the Route Optimization API?
I already tried submitting a POST request using Routes API headers with content from the Route Optimization API documentation example and it did not work.
Anne Stine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.