admin管理员组文章数量:1414628
I've got a web application using the Google Maps JavaScript API(v3) and I'm hitting the Places API using the JavaScript version as well.
The Places API documentation, when using HTTPS requests, says that you need to add your Places API key (acquired through the Google API Console). The documentation also says that you must verify your identity with a credit card otherwise you are limited to 1000 request a day. Once verified you are allowed 100 000 requests per day.
There is no documentation, however, that says how to add your API key to the JavaScript object you pass into the google.maps.places.PlacesService.search() method...
My client is very concerned with this daily limit, as the app is a kiosk that will be part of a huge trade show where it's likely that the Places API will be pinged more than 1000 times throughout the day...
Can anyone advise on this? Should I rework the code to use the HTTP request method so I can add the key there? Or is it possible, perhaps, to add the key to my initial load of the Google Maps JavaScript API?
Thanks in Advance,
Grammar.
I've got a web application using the Google Maps JavaScript API(v3) and I'm hitting the Places API using the JavaScript version as well.
The Places API documentation, when using HTTPS requests, says that you need to add your Places API key (acquired through the Google API Console). The documentation also says that you must verify your identity with a credit card otherwise you are limited to 1000 request a day. Once verified you are allowed 100 000 requests per day.
There is no documentation, however, that says how to add your API key to the JavaScript object you pass into the google.maps.places.PlacesService.search() method...
My client is very concerned with this daily limit, as the app is a kiosk that will be part of a huge trade show where it's likely that the Places API will be pinged more than 1000 times throughout the day...
Can anyone advise on this? Should I rework the code to use the HTTP request method so I can add the key there? Or is it possible, perhaps, to add the key to my initial load of the Google Maps JavaScript API?
Thanks in Advance,
Grammar.
Share Improve this question asked Jan 5, 2012 at 16:17 grammargrammar 87110 silver badges22 bronze badges 1- I'm confused - are you using the PlacesService as part of the Maps API, or the Places API? If the latter, this says how to use the key: code.google./apis/maps/documentation/places/#PlaceDetails – duncan Commented Jan 5, 2012 at 16:48
1 Answer
Reset to default 6You can add your API console key when loading the JS API as follows:
<script type="text/javascript"
src="http://maps.googleapis./maps/api/js?key=YOUR_API_KEY&sensor=SET_TO_TRUE_OR_FALSE">
However, I don't believe the JS Places service is subject to the same limit; it falls under the 25,000 map loads allowed in the v3 API. In addition, to soothe your client's mind, you can note that for the JS API, "In order to acmodate sites that experience short term spikes in usage (eg. a news gathering organisation or a site that briefly goes viral), the usage limits will only be enforced once a site has exceeded the limits for 90 consecutive days." (From the Usage Limits section of the Maps API FAQ)
本文标签: Google Places JavaScript API v3how can I add my API key to requestsStack Overflow
版权声明:本文标题:Google Places JavaScript API v3, how can I add my API key to requests? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745167997a2645799.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论