Google Places JavaScript API v3, how can I add my API key to requests? - Stack Overflow

I've got a web application using the Google Maps JavaScript API(v3) and I'm hitting the Place

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
Add a ment  | 

1 Answer 1

Reset to default 6

You 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)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745167998a4614750.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信