1

When I use the following url:

http://maps.googleapis.com/maps/api/directions/json?origin=Cais%20do%20Sodre&destination=Gare%20do%20Oriente&sensor=false&mode=transit

I'm getting the result

{
"routes" : [],
"status" : "INVALID_REQUEST"
}

but it works on google maps. Am I doing something wrong?

pedroremedios
  • 763
  • 1
  • 11
  • 39

1 Answers1

3

When you use transit mode in a directions request, there are additional required parameters:

Either the arrival_time or the departure_time parameter must be specified any time you request transit directions.

This returns a response for me:

http://maps.googleapis.com/maps/api/directions/json?origin=Cais%20do%20Sodre&destination=Gare%20do%20Oriente&sensor=false&mode=transit&arrival_time=12
geocodezip
  • 158,664
  • 13
  • 220
  • 245