Why I failed to access google autocomplete API eve

2019-07-27 06:25发布

I tried to access

https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=Amoeba&types=establishment&location=37.76999,-122.44696&radius=500&sensor=true&key=AIzaSyAqTo6fgd8zK8rVNxvSO8WsEkBxRxd3PIE

I got access denied.

As you can see, I have provided some key API. Maybe I supplied different key

Here is the problem.

I got my key from https://code.google.com/apis/console/#project:299025262955:services

I enabled all these services

Ad Exchange Buyer API Courtesy limit: 1,000 requests/day

Google Maps API v2          Courtesy limit: 25,000 requests/day • Pricing
Google Maps API v3          Courtesy limit: 25,000 requests/day • Pricing
Google Maps Coordinate API          Courtesy limit: 1,000 requests/day
Google Play Android Developer API           Courtesy limit: 15,000 requests/day
Google+ API             Courtesy limit: 10,000 requests/day
Static Maps API             Courtesy limit: 25,000 requests/day • Pricing

Moreover, I read somewhere that google map API 3 does not use key at all to further add confusion.

So, what API key I should have been using anyway? Google API Key? Google Map API Key? Google Map version 3 API key? What?

I access it directly so there is no referrer. Is that the issue? The setting for referrer is:

Referers:
Any referer allowed

I wonder if that includes blank referrer.

3条回答
唯我独甜
2楼-- · 2019-07-27 06:36

It seems the key you specified is wrong. I swapped the key to mine, then it worked.

enter image description here


You should use the key which appears at "Simple API Access" in "API Access" page. enter image description here

查看更多
叛逆
3楼-- · 2019-07-27 06:51

I found out what the problem is. Google AutoComplete is part of google places instead of google map. So I need to turn on google places feature.

It still sucks though because it doesn't tell me the latitude and longitude of places found.

查看更多
迷人小祖宗
4楼-- · 2019-07-27 06:54

using google place API may cause charge. you are limited to only 1000 request per day and this will be extended to 25000 per day if you validate a credit card. exeeding this limits will cause you charge or the user will notre receive response from the service. be aware of the details and google policies. good luck

查看更多
登录 后发表回答