1

I am trying to do a simple geocoding query to the google maps api. I am getting a message denied error for seemingly no reason. I see a ton of posts with the same question but I seem to be doing what those weren't and still get the error.

Also adding the sensor parameter at the end results in a denied message whereas having the sensor param as the first gives me zero results. I am obviously doing something stupid. Can someone check please?

I am pasting multiple attempts I did and the results -

  1. A HTTP POST attempt -

    curl --data "sensor=false&address=22222" http://maps.googleapis.com/maps/api/geocode/json

    { "error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", "results" : [], "status" : "REQUEST_DENIED" }

  2. Using the example specified in the developer page with sensor param as the first one and XML.

    curl http://maps.googleapis.com/maps/api/geocode/xml?sensor="false"&address="1600+Amphitheatre+Parkway,+Mountain+View,+CA"

    $ <?xml version="1.0" encoding="UTF-8"?> <GeocodeResponse> <status>ZERO_RESULTS</status> </GeocodeResponse>

  3. Using the example specified in the developer page with sensor param as the last one.

    curl http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

    $ { "error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", "results" : [], "status" : "REQUEST_DENIED" }

  4. Another attempt

    curl http://maps.googleapis.com/maps/api/geocode/json?address="22222"&sensor=false

    $ { "error_message" : "The 'sensor' parameter specified in the request must be set to either 'true' or 'false'.", "results" : [], "status" : "REQUEST_DENIED" }

  5. Yet another one.

    curl http://maps.googleapis.com/maps/api/geocode/json?sensor=false&address="22222"

    $ { "results" : [], "status" : "ZERO_RESULTS" }

user220201
  • 4,514
  • 6
  • 49
  • 69
  • Turns out this is a curl command line usage error. It works if I just put double quotes around the http params like this -- curl http://maps.googleapis.com/maps/api/geocode/json?"sensor=false&address=22222" – user220201 Dec 26 '13 at 22:11

2 Answers2

1

Try double quotes for the whole URL, like this:

curl "http://maps.googleapis.com/maps/api/geocode/json?address=22222&sensor=false"
semitkin
  • 53
  • 1
  • 6
0

Another option is to escape the & symbol:

curl http://maps.googleapis.com/maps/api/geocode/json?address=22222\&sensor=false

which works for me.

Peter K.
  • 8,028
  • 4
  • 48
  • 73