【问题标题】:Google Place API - Always return this "status" : "REQUEST_DENIED"Google Place API - 始终返回此“状态”:“REQUEST_DENIED”
【发布时间】:2013-06-17 07:30:12
【问题描述】:

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

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

输入latitude,longitude和API key等信息并设置sensor等于false,但总是显示:

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

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

【问题讨论】:

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


    【解决方案1】:

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

    否则其他一切看起来都还不错,这让我觉得您可能想再次检查您的 api 控制台,转到 SERVICES 并检查您的“Places API”是否已打开。

    您也可以尝试将端口地址更改为 443 以获取 Places API 的响应

    【讨论】:

    • 我已经尝试了这里提出的三个建议的所有可能组合,但没有成功。我的 API 密钥很好(它适用于地图),并且在控制台中启用了 Places API。使用端口 443 会导致 http 或 https 响应不佳。这个答案对你有什么帮助?
    • @David Mays 如果可能,请尝试删除并重新创建您的密钥或创建一个新密钥。如果可能,请在此处粘贴您的请求,我在上面发布的内容一直为我和朋友工作。
    【解决方案2】:

    Places API 在以下情况下返回“状态”:“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.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-15
      • 2017-09-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-01
      • 1970-01-01
      相关资源
      最近更新 更多