Question

I'm creating app that use autocomplete places google api.

And I don't know what is wrong but all the time I got responses like:

{
    "predictions" : [],
    "status" : "REQUEST_DENIED"
}

I send req : https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Paris&types=geocode&language=fr&sensor=true&key=mykey

Documentation says :

REQUEST_DENIED indicates that your request was denied, generally because of lack of a sensor parameter.

I have sensor parameter, maybe it is something with api key.

Is there any page where can I get google's log :), to see why I got REQUEST_DENIED?

I use api key from :

http://code.google.com/intl/pl-PL/android/maps-api-signup.html

Maybe I have to get an api key from somewhere else.

Was it helpful?

Solution

That's the wrong API key. Follow the steps here to get the right one.

OTHER TIPS

You should be able to view your API Key by going to the API Console first: https://code.google.com/apis/console

If you haven't yet, you will need to create a new "Project" and then enable the Predictions services first by using the On/Off switch.

Please post your results, I have a similar problem with getting the REQUEST_DENIED response, but I've already got the API key and I'm using the sensor parameter like their documentation states.

It is frustrating that Google doesn't give any sort of response code along with REQUEST_DENIED so you can see why it's denying it. This will be difficult to support and troubleshoot in a production environment if this randomly goes out without providing any details as to why.

Update:

I just found this works for me now, but only after changing my requests to GET requests instead of POST. For reasons unknown, Google returns REQUEST_DENIED for POST requests but allows the same request via GET. A quick test for you to see if this is your problem would be to put the URL together with your API key and other parameters and try it through your browser instead. If that works then just rewrite your Android code to use GET instead of POST and you should be all set.

It was solved for me when I exchanged the API key. I was using the one under Android device, I changed it to the one "Key for browser apps (with referers)" and it worked for me although I'm using Android Device.

Make sure you API keys are generated correctly and that you have enabled the necessary APIS. In my case, when designing iOS application - I need to enable Google Maps SDK for iOS, Google Places API for iOS

And most importantly, and without being mentioned by Google (in any other place as well) enable Google Places API Web Service.

With this, I ended a 2 day search for my pesky problem.

And, of course, make sure you use Key for server applications

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top