Status Update
Comments
ca...@google.com <ca...@google.com>
ca...@google.com <ca...@google.com> #2
Thank you for posting.
Upon checking, it seems that we could not replicate the issue reported. Kindly try again and if the issue still occurs, kindly provide additional details like the complete sample request
including all the values of the parameters used
with screenshots in a standard image format (e.g. PNG or JPEG) or screen recordings and steps to reproduce the issue.
Sample requests:
curl -X POST -H 'content-type: application/json' -d ' {
"origin":{
"location":{
"latLng":{
"latitude": 42.534239,
"longitude": -71.471586
}
}
},
"destination":{
"location":{
"latLng":{
"latitude": 42.395148,
"longitude": -71.142493
}
}
},
"travelMode": "DRIVE",
"routingPreference": "TRAFFIC_AWARE_OPTIMAL",
"trafficModel": "OPTIMISTIC",
"departureTime":"2025-10-01T12:00:00Z"
}' \
-H 'Content-Type: application/json' \
-H 'X-Goog-Api-Key: YOUR_API_KEY' \
-H 'X-Goog-FieldMask: routes.duration,routes.distanceMeters' \
'https://routes.googleapis.com/directions/v2:computeRoutes'
Result:
{
"routes": [{
"distanceMeters": 37483,
"duration": "2483s"
}]
}
mb...@gmail.com <mb...@gmail.com> #3
mb...@gmail.com <mb...@gmail.com> #4
I troubleshooted this again and realized that the issue is that not all values of the routingPreference parameter are compatible with the trafficModel parameter. When the routingPreference is set to "TRAFFIC_AWARE" and the trafficModel parameter is used, the request fails. If the routingPreference is changed to "TRAFFIC_AWARE_OPTIMAL" instead, the request succeeds.
routingPreference = "TRAFFIC_AWARE", trafficModel parameter not used --> success
routingPreference = "TRAFFIC_AWARE", trafficModel parameter used --> failure
routingPreference = "TRAFFIC_AWARE_OPTIMAL", trafficModel parameter not used --> success
routingPreference = "TRAFFIC_AWARE_OPTIMAL", trafficModel parameter used --> success
Would you be able to update the documentation for the trafficModel (
ca...@google.com <ca...@google.com> #5
Thank you for posting.
We have logged this issue internally. Please note that we cannot give you any timelines, but you can star the issue to get notifications.
mi...@google.com <mi...@google.com> #6
Thanks for the post.
Upon checking, it appears that this is a duplicate of
Description
Request 1 body (succeeds):
{"origin":{"location":{"latLng":{"latitude":42.534239,"longitude":-71.471586}}},"destination":{"location":{"latLng":{"latitude":42.395148,"longitude":-71.142493}}},"travelMode":"DRIVE","routingPreference":"TRAFFIC_AWARE","departureTime":"2025-10-01T12:00:00Z"}
Request 2 body (fails, HTTP 400 Bad Request):
{"origin":{"location":{"latLng":{"latitude":42.534239,"longitude":-71.471586}}},"destination":{"location":{"latLng":{"latitude":42.395148,"longitude":-71.142493}}},"travelMode":"DRIVE","routingPreference":"TRAFFIC_AWARE","departureTime":"2025-10-01T12:00:00Z","trafficModel":"OPTIMISTIC"}