gpt4 book ai didi

java - Google Apis 最近的道路来捕捉道路

转载 作者:行者123 更新时间:2023-12-02 11:11:33 25 4
gpt4 key购买 nike

我刚开始使用 Google api 最近的道路来捕捉道路。

我正在尝试如下链接:

Google api for nearest road

如果我必须尝试

https://roads.googleapis.com/v1/nearestRoads?parameters&key=YOUR_API_KEY

使用我的项目中提供的 api key ,我得到

{
"error": {
"code": 403,
"message": "Roads API has not been used in project **** before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/roads/overview?project=*** then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API activation",
"url": "https://console.developers.google.com/apis/api/roads/overview?project=****"
}
]
}
]
}

替换所使用的 key 。

我在这里缺少什么?我应该在使用之前在某处验证 key 吗?或者,如果我只想尝试一下示例,如何获取 key ?

最佳答案

"Roads API has not been used in project **** before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/roads/overview?project=*** then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",

这个错误消息有点令人困惑。在访问 API 之前,您需要在 Google 开发者控制台上的项目中启用它。为此

  1. 转到https://console.developers.google.com/apis/dashboard
  2. 确保您的项目在顶部被选中。
  3. 去图书馆
  4. 搜索道路 API
  5. 启用它。

等待几分钟,您的代码应该可以运行

详细信息:

当您想要访问 Google 数据时,Google 需要知道您是谁。以及您的项目将做什么。他们通过要求您在谷歌开发者控制台上创建一个项目来做到这一点。在该项目中,您可以定义将使用的 api,还可以请求 api key 和客户端 ID,以便您访问数据。在这种情况下,您在 Google 开发者控制台上设置项目时遇到问题,这与您的代码无关。

关于java - Google Apis 最近的道路来捕捉道路,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50580290/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com