【问题标题】:This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console此 API 项目无权使用此 API。请确保在 Google Developers Console 中激活了此 API
【发布时间】:2018-02-19 05:54:31
【问题描述】:

我需要从谷歌企业帐户获取评论并显示在我的网站上。

I have used below curl method "https://maps.googleapis.com/maps/api/place/details/json?key=$api_key&placeid=$place_id" to get google business reviews.
 I have correctly provided api key,place id also enabled Google Maps Geocoding  and Geolocating . I have got below error. How can I fix?`

Error :  
[error_message] => This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_
    [html_attributions] => Array
        (
        )

    [status] => REQUEST_DENIED

【问题讨论】:

  • 您需要设置api密钥才能访问api。
  • 报错信息很清楚,请问是什么问题?
  • 您需要转到开发人员控制台仪表板,在最顶部有一个指向 API 库的链接。您可以在那里搜索和启用地点 API。您的项目默认没有API,您必须一一启用。

标签: php google-maps-api-3


【解决方案1】:

我在启用 API“Places API”后解决了这个问题。如下图所示,单击“启用 API 和服务”选项。搜索“Places API”并启用此服务。它应该可以解决您的问题。

在我的例子中,我启用了“Places SDK for Android”,并尝试使用下面的 url 调用 Places API,但它不起作用,因为我需要启用“Places API”。

https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Museum%20of%20Contemporary%20Art%20Australia&inputtype=textquery&fields=photos,formatted_address,name,rating,opening_hours,geometry&key=YOUR_KEY

【讨论】:

  • 我在启用 API“Places API”后解决了这个问题。很好的收获。
【解决方案2】:

对于低容量/测试使用,您不需要 google api 密钥。您可以摆脱测试的密钥 - 当您获得 google API 密钥时。查看不使用 google map key 运行的代码:https://plnkr.co/edit/5n66pLOC2rjJbl06tQ7C?p=preview

  <script src="https://maps.googleapis.com/maps/api/js?libraries=places&callback=initMap"></script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-04
    • 2016-02-22
    • 1970-01-01
    • 2019-03-03
    • 2019-05-21
    • 2016-10-29
    • 2014-04-13
    • 1970-01-01
    相关资源
    最近更新 更多