Google Maps JavaScript API V3 - API Key and clientId - google-maps

After reading many online forums/blogs, it's pretty clear to me that Google Maps API V3 do not require API key anymore.
And for more advanced google map features, I should have clientId (which my organisation already have).
But what is confusing to me is that I found two places -
First, where I get the information that API key is still good to use
'All Maps API applications should load the Maps API using an API key'
Google Maps JavaScript API V3 Documentation
Second, where I get information that we should definitely avoid using API key and replace them with clientId
https://groups.google.com/forum/#!topic/google-maps-js-api-V3/oJf7I5FdAdY
http://egis3.lacounty.gov/eGIS/2011/12/06/google-maps-api-v3-to-stop-ignoring-the-key-parameter/
Can please guide if I am missing something and which one should I take as the correct information.
Thank you!

I think if the documentation says "All Maps API applications should load the Maps API using an API key," then that is the advice to follow. It's probably better advice than postings in a forum (including, perhaps, this one).
It's true that Version 3 will work without a key; but there is no guarantee that they will continue to do so, particularly in the light of the documentation; and using a key brings the benefits of statistics reporting.
The client ID is associated with an Enterprise licence, which raises some of the limits associated with a ordinary free key. Neither unlocks advanced features of the map; both allow usage reporting.

Yes, you have missed something !
The two links you give at the end of your question relate to moving from v2 of the API (where a key was obligatory) to v3 of the API where a key is optional.
It is not necessary to have a key for v3 of the API if you will not have more than 25000 map loads per day.
Over this limit, it is apparently required that you obtain a key and a premium account (payable).
Ensure that you have really understood the contents of the first link you gave, notably the section Obtaining an API key.
Then jump to the linked page on Usage Limits.
I reiterate what I have said : it is NOT required that you have an API key for v3.

Related

Google API key Vs. Google Client ID

One of our customers is using google maps with a "Client ID". We've developed our product using the Google API Key. All of the features of the map are working properly using the API key, but we are unable to confirm that the client will get the same results with the Client ID since we do not have one. Two question, do you believe that the features will work the same using either the API or the Client ID? Second question, how much does it cost to purchase a Client ID?
Client IDs and API Keys are forms of authentication and authorization. There are easy-to-follow guidelines on their proper usage and their limits. Everything you need to know about them can be found in the documentation (also try seeing the docs per product in the 'For more information' section):
https://developers.google.com/maps/premium/overview#authentication_and_authorization
Related SO post and answer about using Client IDs for their Javascript API:
google maps api javascript usage
For pricing, read more about it here:
https://developers.google.com/maps/pricing-and-plans/
EDIT: There has been recent Google Maps Platform pricing and product changes You'll always need an API key and a valid billing account associated to your Project if you want to use the Google Maps Platform APIs. If you've never had a Client ID then you don't need to worry about it, just continue using your API keys.
You may run into some APIs (i.e. Speed Limits API) that seem to need a Premium Plan account. If you really need access to these, simply contact sales using this form.
P.S.
When using API keys, be sure to properly restrict them!

What is the need for API key?

The tutorial for Google maps API states that an API key is required for making calls to the API. The example given on the page however does not use an API key. So why would'nt someone choose to make the call without an API key and not worry about exceeding any limits?
Thanks,
Yash
Since version 3 you the API key is not mandatory anymore. You still can provide one though to track your usage because the limit still exists. See also this answer.

Google Maps API Key - Get one for everyone of my users programmatically?

I saw that one has not to obtain a Google Maps API key if you want to use their maps api in general, only if you want to use their web services and statistics etc.
Now I have two questions regarding this:
If I have a public website which uses the Google Maps API to display a map with default options. How does Google count the API calls if I don't use an API key? (Maybe with the help of the domain which requests the map?)
If they do so and my site exceeds the 25k calls/day, is there a possiblity that my users can login with their Google account on my site and some backend logic will get them an API key from Google that I store e.g. in a database. So I could use the API keys of my users to bypass the API usage limits only for my site.
Assuming you are using the Javascript API v3:
This SO question partially answers your queries.
Have a look at the usage limits, it looks like that you cannot use more than one API key:
Can I use more than one API key to increase my available usage over
the documented limits?
Google reserves the right to withhold access to the Maps API from any site that attempts to use more than the permitted number of map
loads of the Maps API without permission, and fails to respond when
contacted by Google.
Though this may be debatable, to me it seems a bad idea using your user's API key. For sure you need to ask the permission, then you have to monitor their quotas and so on, a minefield...
TL;DR if you exceed constantly the daily quota you should purchase a larger quota.

use multiple Google Maps API Keys for same server?

I have a server which acts as a mesh.
I have 3 mobile apps, each having it's own google maps api Key
all three apps call my server which calls the google apis with the specific app key.
so App1 has key1
App2 has Key 2
App3 has key 3
when I need the directions for App1, my server calls google api with key 1
when I need the directions for App2, my server calls google api with key 2
when I need the directions for App3, my server calls google api with key 3
So my server works like an API mesh. Is this against google terms? I am afraid they will look at the ip address of the server, see there are 3 keys used and assume I am using different Keys for same applications which is prohibited.
The short answer (drawn from the FAQ) is quite simply : no, you can't use two keys in this case.
See https://developers.google.com/maps/faq#usage_avoidance
- they even reserve "the right to withhold access to the maps API from any site" doing so, just as you feared.
Using more than one key, even though it could only be a matter of convenience for you, means for them trying to cheat and bypass the limitation of 25,000 requests per day and per service. And they don't like that, because they want big users of their maps API to pay, of course. Prices are listed on the same page.
You should read the FAQ paragraphs "Understanding the Terms of Service" and "Usage limits" completely - it is quite short but sometimes a little tricky. You'll see that there are a few situations in which you do not actually have to pay even when exceeding limitations :
you are using the google earth API
you are using a native maps API from a mobile platform
you are showing a google map through an embed only
your apps are "in the public interest (as determined by Google at its discretion)"
Also, you do not always need to provide an API key, though these products may still be available for limited use only : take for instance the geocoding API.
I guess you're not in one of those cases (at least bullets 2 and 3) since your calls transit through your server. Using the native APIs in mobile apps would solve the problem, but it does mean quite some development I guess.
It is also worth noting that you should apply for a special maps API for business license for some use cases, e.g. when only paying users get to see your map.
In conclusion, you need to have one single google maps API key when it comes to using their products that require one. Or rather, at most one per domain name.

Google Places API Limits

I am looking into the Google Places Autocompleter. It works perfectly, I tried using the code provided.
However I see they mention something about limits per API key. First of all, I don't have an API key, and it works. I dont see a limit regarding no API keys?
Secondly, do they limit per client IP (the browser that is viewing my site), per domain, or something else?
If they limit per domain, will sub1.domain.com and sub2.domain.com share the same limit?
I can't seem to find anything regarding this in the Google documentation, which is why I am asking here. Thanks!
Edit: So I signed up for an API key, but they dont tell me where to include it to use the Places Autocomplete?
The Google Maps JavaScript API V3 Places Library does not require an API key to implement and does not have a documented limit. However, if a user performs more queries than deemed acceptable by Google in one minute, they will receive the OVER_QUERY_LIMIT status in response to a request.
As far as the key is concerned, it's only required for the Places web service: https://developers.google.com/maps/documentation/places/
Your doc link is to the Places library - that's a service of the JavaScript API v3. A key isn't required there, though you can include one by adding &key={yourkey} when you load the Maps JS (https://developers.google.com/maps/documentation/javascript/tutorial#HelloWorld).
So:
Places web service: key required
Places JavaScript service: no key required
I don't know about specific autocomplete limits, but the JS API has limits mentioned here: https://developers.google.com/maps/documentation/javascript/usage. Basically, 25,000 map loads per day, with the option to purchase more if required.
Hope that helps.