8

I'm trying to make a request to the Google Places API, using the following url: https://maps.googleapis.com/maps/api/place/search/xml?location=37.77264,-122.409915&radius=500&types=educational%20services&name=everest%20college%20san%20francisco&sensor=false&key=YourApiKey

This is the response I get:

<PlaceSearchResponse>
  <status>REQUEST_DENIED</status>
</PlaceSearchResponse>

Any idea what could be wrong with the above URL?

flexdroid
  • 8,437
  • 2
  • 21
  • 27
Mathi
  • 97
  • 1
  • 1
  • 2

13 Answers13

14

IMPORTANT: Go to the api console here, then to SERVICES and check if your 'Places API' is turned ON

Devaroop
  • 7,900
  • 2
  • 37
  • 34
7

NOTE: - I had implemented it in Android APP.

I was facing the same problem with this API..

Most of the solutions/ suggestions available on net are regarding the wrong key.

But how to get the appropriate key? very little help is there regarding this.

The sole reason behind it in my case was wrong KEY.

I was using my Android Key (The one we use for google Maps) to access google places, that's why it was giving me ACCESS DENIED response.

After Struggling for some hours I noticed in Google API Documentation somewhere there was a screenshot how to create KEY

in that I noticed they key they were using was in "Key for browser apps (with referers)"

whereas the one I was using was in "Key for Android apps (with certificates)"

.....

and to get the respective key We need to create a Browser Key.

They key I was using initially was

enter image description here

The required key is enter image description here

to get the required key :- just click on "Browser Key" and click again the input it askes for regarding some url is not a mandatory field

enter image description here

For further detail how to use it in ANDROID refer this link

Don't forget to Turn On on the Services "Places API" from API Console

mplungjan
  • 169,008
  • 28
  • 173
  • 236
DeltaCap019
  • 6,532
  • 3
  • 48
  • 70
  • 1
    The "accept requests from these HTTP referrers" part is important, you have to leave it blank when you're working on a development site (or locally). –  Feb 22 '14 at 15:09
7

Maybe you should Add "&sensor=true /false " on the end of the Url which you are sending.

lanyimo
  • 367
  • 1
  • 3
  • 13
4

Great to see these many solutions. let me add another to the list. You can also try changing the Port address to 443 to get response from Places API

Kivan
  • 41
  • 1
  • What does that mean? Could you please elaborate? – Nawaz Jul 23 '13 at 14:16
  • I have no idea why this fixes it, but it worked for me. As soon as I put :443 in front of the domain name, it immediately worked, but the browser (Chrome) removed the :443 from the address. But subsequently, I could just use the normal address without the :443 and it still worked. Weird!! – Jonathan Oct 13 '13 at 05:20
2

In my case, the problem was I tried to use the API key for Android (which seems fairly logical) but then I tried to change it for the browser's API key and it finally works right now. Why? Don't ask me. :)

Hope that helped.

Pilsner25
  • 141
  • 1
  • 5
1

I was having the same issue, kept getting request denied.

I double checked to ensure my API key is correct, what I didnt realise was that I needed to create a New Server Key from the API Console. Now I get ZERO results, instead of the denied message.

Naz
  • 41
  • 3
1

My situation was that I had the API turned on, I generated the API key but I had also added some IP addresses to limit where the API requests were coming from. However, if you're developing locally, you shouldn't set any IP address because the IP address could be from your router (192.168.1.120) or from the ISP (238.382.33.298) or whatever so there's no good way to limit the API requests by IP address.

When you are developing locally, set it to blank.

When you are deploying to production or some other development server that has a constant IP address, set it to whatever the IP address of the server is.

1

Your key looks to be invalid, as mentioned by @Bryan Weaver in the comments. Substituting my own key in the request returns ZERO_RESULTS instead.

BTW, you should also check out the list of supported types - educational%20services isn't one of them. That's not what's giving you the REQUEST_DENIED, but it's worth fixing anyway. If you ever want to specify multiple types, separate them with a pipe (|).

Mike Jeffrey
  • 3,149
  • 1
  • 19
  • 18
0

The Places API is distinct from the maps API. Please enable Places API separately on your API console

svs
  • 2,425
  • 1
  • 14
  • 10
0

Go to the api console here, then to SERVICES. Click Active services tab and verify 'Places API' is turned ON. Click on the ? "try" link next to it. It should create a proper URL with your key which should work. Compare the link that you are trying against this URL for differences.

0

In my case, it was the HTTPS instead of HTTP as well as a range that was to small.

Resh32
  • 6,500
  • 3
  • 32
  • 40
0

I've had a similar issue, fixed it and discovered a few things that may be useful in troubleshooting this

  • using http instead of https will result in REQUEST_DENIED
  • omitting &userIp=x.x.x.x will result in REQUEST_DENIED
  • a server key needs to be generated and used in case the request is from a php script even if ONLY consumed via browser by users or it will result in REQUEST_DENIED
  • a few minutes are necessary before testing if the list of IPs allowed has been changed

Hope it helps some of you guys

sdrubish
  • 199
  • 10
0

To find the actual error, run the api query in the browser directly or map the error to your object.

{
   "error_message" : "You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started",
   "html_attributions" : [],
   "results" : [],
   "status" : "REQUEST_DENIED"
}
Arun Prasad E S
  • 9,489
  • 8
  • 74
  • 87