如何从浏览器中试用Google Places API?

时间:2016-01-04 22:33:07

标签: api google-maps

所以我想先将Google Places放入我的代码之前尝试一下......如果这就是我需要的话,请先查看。

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=cruise&key=AddYourOwnKeyHere

所以这是我试图测试的链接,我使用自己从控制台创建的密钥。我遵循所有的stepes但仍然得到错误' REQUEST_DENIED'。

步骤: - 创建我的项目。 - 选择Google Places Web服务Api并启用它。 - 转到凭证,新API密钥 -Browser键类型 - 得到了它。

任何线索?

2 个答案:

答案 0 :(得分:0)

使用服务器密钥进行Web服务,如the documentation

中所述
  

获取Google Places API网络服务的密钥

     
      
  1. 转到Google Developers Console
  2.   
  3. 创建或选择项目。
  4.   
  5. 点击继续以启用API。
  6.   
  7. 转到凭据以获取服务器密钥(并设置API凭据)。
  8.   
  9. 为防止配额被盗,请按照best practices
  10. 保护您的API密钥   

答案 1 :(得分:0)

似乎没有方便的UI可以从Web上查询它。相反,只需查阅Places API文档,然后将以下样式的查询粘贴到例如浏览器地址栏中。

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?key=YOUR_API_KEY&inputtype=textquery&input=Starbucks