Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to place API key for Google Geocoding API?

We use Google Geocoding API to map address to Latitude and Longitude.

Here is the sample URL for encoding (which returns json) -

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

Message: OVER_QUERY_LIMIT

Ok, it makes sense, because we exceed over 2500 daily limit so we place API key like this -

http://maps.googleapis.com/maps/api/geocode/json?key=xxxxx&address=Dallas&sensor=false

Message: REQUEST_DENIED

I'm wondering where/how to place the API Key.

like image 271
Win Avatar asked Aug 23 '13 19:08

Win


People also ask

Where do I put API key in URL?

But for the purposes of this guide, you'll include an API key in a URL that you'll use in your JavaScript code on the front end.

Where do I use API key?

API keys provide project authorization By identifying the calling project, you can use API keys to associate usage information with that project. API keys allow the Extensible Service Proxy (ESP) to reject calls from projects that haven't been granted access or enabled in the API.


1 Answers

Looks like in version 3 you need to pass the ClientID in the URL and not a key as you do in the free version: https://developers.google.com/maps/articles/v2tov3#newkey

So your URL should look like: http://maps.googleapis.com/maps/api/geocode/json?client=xxxxx&address=Dallas&sensor=false

Not lucky enough to have a paid account so I cannot test - but I think that will get you on the correct path.

Relevant from this link: https://developers.google.com/maps/documentation/business/webservices/

Client ID

You must include your client ID in all API requests. Your client ID identifies you as a Maps API for Business customer and enables support and purchased quota for your application. Requests made without a client ID are not eligible for Maps API for Business benefits.

If you're switching from the free API services to a Maps API for Business implementation, you must remove the key parameter from your requests. Google Maps API web services will deny requests made with both a client ID and a key.

More information is available in the Authentication and Authorization chapter of this guide.

If you have lost your client ID, you can recover it by logging in to the support portal and clicking Maps: Add URLs from the links on the left of the page.

EDIT

For more information, including instructions on passing your client ID to the Earth API, v2 API, and the Maps API for Flash, please read Loading Client-side APIs.

If you have lost your client ID or cryptographic key, you can recover them by logging in to the support portal and clicking Maps: Add URLs from the links on the left of the page.

like image 106
Matthew Avatar answered Oct 21 '22 05:10

Matthew