1
votes

I am getting INVALID_REQUEST for certain requests while its working for others. For example, the following returns INVALID_REQUEST

http://maps.googleapis.com/maps/api/directions/json?origin=EC3N4AB&destination=EC4M8AD&sensor=false&mode=transit

I have also tried several other variations like the one below:

http://maps.googleapis.com/maps/api/directions/json?origin=EC3N4AB,UK&destination=EC4M8AD,UK&sensor=false&mode=transit

This same piece of code is working for some postcodes in the UK but returning INVALID_REQUEST for others. If you search for the postcodes in google maps web interface (EC3N4AB and EC4M8AD), the web interface can easily provide directions.

Wondering what is wrong with my URL? Any help will be appreciated.

Cheers,

2

2 Answers

4
votes

Google made departure_time or arrival_time mandatory on API requests. This URL works:

http://maps.googleapis.com/maps/api/directions/json?origin=EC3N4AB&destination=EC4M8AD&sensor=false&mode=transit&departure_time=1343376768

Thank everyone for their help.

0
votes

Try to use region parametre:

http://maps.googleapis.com/maps/api/directions/json?origin=EC3N4AB&destination=EC4M8AD&sensor=false&mode=transit&region=uk

Another reason may be that does not support transit (try with driving, work good ;-) )

Regards

cadetill