Google Place API - 始终返回此“状态”:“REQUEST_DENIED”

时间:2013-06-20 12:29:02

标签: google-maps-api-3 google-places-api

我目前正在使用Google Place API,每当我要访问此链接时,我都会遇到问题

https://maps.googleapis.com/maps/api/place/search/json?location=latitude,longitude&radius=1&sensor=false&key=apikey

输入纬度,经度 API密钥等信息,并将传感器设置为false ,但始终显示:

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

我已经搜索过这种错误了,我看到有些帖子建议检查传感器值并检查 API密钥。我已经检查了它,并检查了Google Maps API v3的服务是否已启用。但没有什么对我有用。我是新手,我不知道我做错了什么,请帮助。

2 个答案:

答案 0 :(得分:8)

您正在使用http(s)来调用Google API,您的html也是在http(s)下托管的。如果没有,请尝试将google网址更改为http。

否则其他所有其他东西看起来都不错,这让我觉得你可能想再次检查你的api控制台,转到服务并检查你的'Places API'是否已打开。

您还可以尝试将端口地址更改为443以从Places API

获取响应

答案 1 :(得分:0)

在以下情况下,Places API会返回“status”:“REQUEST_DENIED”:

You have not activated the Places API Service in the services tab of the APIs console.
The sensor parameter is missing from your request, or is set to something other than true or false.
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.