我是Google Places API的新手,請閱讀它 - https://developers.google.com/places/documentation/。 它需要一個密鑰。但我發現其他的東西 - https://developers.google.com/maps/documentation/javascript/examples/place-search 它沒有關鍵的工作。如果只需要一種方法而不需要其他方法,這個關鍵點有什麼意義?Google Places API和Google Javascript API - 密鑰
1
A
回答
1
在我開始之前:這個答案比猜測更基於事實。
對位置API的請求有限制,所以請求必須連接到網站(HTTP-Host)或API項目(在控制檯中創建)以便能夠對它們進行計數(並在達到限制時限制訪問)。
第一個鏈接與Places-webservice有關,該服務用於來自服務器端的請求。當您從服務器端發送請求時,無法確定請求來自哪個網站(除非您發送HTTP-REFERER
-標頭,但這是沒用的,因爲您可以使用任意值發送標頭)。所以你需要在這裏找到你的API項目的鑰匙,並將請求連接到你的賬戶。
第二個鏈接與Maps-Javascript-API的Places-library相關。在這裏可以通過javascripts document.location
來識別網站。當您在加載地圖看一看網絡流量,你會看到
http://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent
的請求,這個請求有一些額外的參數,這些參數之一是當前網站的位置... JS-API現在可以將來自JS-API的任何請求連接到您的網站。
但是:雖然Maps-Javascript-API沒有使用密鑰,但推薦使用那裏的密鑰。使用密鑰(以及其他方式)時的好處:當您使用密鑰時,您擁有一個Google帳戶,並且Google可以在開始限制訪問權限之前與您聯繫(例如,讓您有機會修改您的應用程序或購買額外配額)。
相關問題
- 1. 無法添加Google Places API密鑰
- 2. 新的Google API密鑰「Google地圖API v3」不適用於Google Places API?
- 3. Google places Api Key
- 4. Google Maps Javascript API密鑰
- 5. Google Places API限制
- 6. GoMaps和Google API密鑰
- 7. Google Places API Places照片
- 8. Google Places API Places Types
- 9. Google Places API cors
- 10. 獲取API密鑰 - Google Maps JavaScript API
- 11. 使用Google Places API瀏覽器密鑰或應用密鑰REQUEST_DENIED?
- 12. Google Maps Places API
- 13. Google Map API密鑰到期
- 14. Google Maps API密鑰和robots.txt
- 15. 保護Google Maps JavaScript API密鑰
- 16. Google Places API錯誤
- 17. 檢索Google Maps API密鑰
- 18. Google Places API Swift
- 19. Google Places API - android
- 20. Google Places API
- 21. Google Places Api Android
- 22. Google Places API subway_station ,?
- 23. Google Places API Warning
- 24. Google Maps Javascript API Places Library
- 25. Google Maps JavaScript Places API - URL undefined
- 26. 爲什麼Google Places JS API不使用API密鑰?
- 27. Google開發者API密鑰和YouTube API
- 28. 限制使用Google Places JavaScript API?
- 29. Google Places JavaScript API v3,如何將我的API密鑰添加到請求中?
- 30. 如何爲Google Places api製作API KEY?