Google 地图 API 请求:限制问题

Google Maps API request: Restrictions problem

我正在构建 PowerApps 应用程序,对 Google 地图 API 的请求很少。首先是生成静态地图(它工作正常)。第二件事是建立流量以获得特定位置附近的地方(按类型)。

我对 API 的请求: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=XXX,YYY&radius=1500&type=restaurant&key=MY_KEY

但作为回应我得到了错误回应:

{
  "error_message": "This API project is not authorized to use this API.",
  "html_attributions": [],
  "results": [],
  "status": "REQUEST_DENIED"
}

问题是,我们设置 API 密钥 没有任何限制 - 具体没有关于使用 API 接口的限制。

也许有人解决了类似的问题?

@geocodezip 是正确的。 Google Cloud 中的每个项目都必须单独启用 API。这与您对 API 密钥施加的限制不同。

https://console.cloud.google.com/apis/library/places-backend.googleapis.com

如果您注意到您的错误消息表明您的项目未获得授权,而不是密钥。关键没问题,你只需要在 Google Cloud Project 中启用 Places API。