Heath Kelly
Heath Kelly

Reputation: 123

Google Maps Geocoding API - Request Denied using API Key

I'm trying to use the Google API geocode service as follows:

https://maps.googleapis.com/maps/api/geocode/json?&address=melbourne&key=xxx&sensor=false

The response I get is always:

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

I have both Google maps API v3 and Places API services enabled. I have even set up billing. I have tried deleting and recreating numerous keys - all with the same effect. I have tried the service from different networks, also with the same result.

In the reports section of the Google API dashboard I can see the number of request accumulating but the response is always Request_Denied.

Can anyone help?

Upvotes: 12

Views: 28161

Answers (3)

Josh
Josh

Reputation: 2006

The REQUEST_DENIED status is returned by the Places API when:

  • You have not activated the Places API Service in the services tab of the APIs console.
  • The key parameter is missing from your request.
  • The key parameter does not match the your API key in the API Access tab of the APIs console.
  • Your API key has not been correctly set up in the API Access tab of the APIs Console:
  • If you are using a Browser key, check that your allowed Referer(s) are correct.
  • If you are using a Server key, check that your allowed IP(s) are correct.
  • Android and iOS keys are not supported, please use a Browser or Server key.
  • The request was not sent as an HTTPS request, HTTPS is required for all Web Service requests.
  • The incorrect HTTP method was used to send the request:
  • All requests must be sent as a GET request except for Place Actions.
  • All Place Actions must be sent as a POST request.

I failed to whitelist my production server's IP address.

Upvotes: 24

Yasssine ELALAOUI
Yasssine ELALAOUI

Reputation: 539

Only change the googleapis source like this

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>

Upvotes: 0

Shervin
Shervin

Reputation: 1965

It seems intentional that the key doesn't work with simple HTTP queries for Geocoding. Google is preventing any possible repurposing of the data. See the "Usage Limits":

"The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited."

You can load the results on a map using the Javascript API as explained here.

Upvotes: 0

Related Questions