2013-04-17 181 views
11

我想如下使用谷歌API地理編碼服務被拒絕:谷歌地圖API地理編碼 - 要求使用API​​密鑰

https://maps.googleapis.com/maps/api/geocode/json?&address=melbourne&key=xxx&sensor=false 

我得到的迴應總是:

{ 
    "results" : [], 
    "status" : "REQUEST_DENIED" 
} 

我有Google maps API v3和Places API服務均已啓用。我甚至設置了帳單。我嘗試刪除並重新創建衆多鍵 - 所有這些都具有相同的效果。我嘗試過來自不同網絡的服務,結果也一樣。

在谷歌API控制檯的報告部分,我可以看到的請求累計數,但反應總是Request_Denied

任何人都可以幫忙嗎?

+3

失去'key'。它的工作原理沒有它:https://maps.googleapis.com/maps/api/geocode/json?&address=melbourne&sensor=false – Shervin

+0

是啊,我知道...但要求每天限制在1000,我需要多那。關鍵是每天發放25000個請求,然後在那之後支付請求.....需要讓關鍵工作。 –

+0

事實證明,這個API僅適用於[Maps API企業版(https://developers.google.com/maps/documentation/business/webservices)的客戶。你有沒有看一下我們在谷歌地圖的JavaScript V3 [地理數字圖書館(https://developers.google.com/maps/documentation/javascript/geocoding)? – Brett

回答

19

「狀態」: 「REQUEST_DENIED」 由地方API返回時:

You have not activated the Places API Service in the services tab of the APIs console. 
The key parameter is missing from your request. 
The key parameter does not match the your API key in the API Access tab of the APIs console. 
Your API key has not been correctly set up in the API Access tab of the APIs Console: 
If you are using a Browser key, check that your allowed Referer(s) are correct. 
If you are using a Server key, check that your allowed IP(s) are correct. 
Android and iOS keys are not supported, please use a Browser or Server key. 
The request was not sent as an HTTPS request, HTTPS is required for all Web Service requests. 
The incorrect HTTP method was used to send the request: 
All requests must be sent as a GET request except for Place Actions. 
All Place Actions must be sent as a POST request. 

https://developers.google.com/places/faq#why_do_i_keep_receiving_status_request_denied

我沒有白名單我的生產服務器的IP地址。

+0

如果Android和iOS密鑰不受支持,爲什麼讓我們在第一時間創建它們!?!?!?!? –

+0

@MarcoLuglio因爲其他一些谷歌的API確實允許這些類型的鍵(例如,谷歌雲願景API)。但我確實認爲這很混亂。 – thijsonline

0

似乎故意,關鍵不與地理編碼簡單的HTTP查詢工作。谷歌正在阻止任何可能的數據重新調整。見"Usage Limits"

「地址解析API僅可與谷歌地圖結合使用; 地理編碼的結果,而被禁止在地圖上顯示它們。」

您可以使用JavaScript API在地圖上加載結果,如here所述。

0

只有改變googleapis源這樣

<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>