使用 Api 密钥响应超出配额

发布于 2025-01-16 12:19:15 字数 991 浏览 4 评论 0原文

我正在尝试访问 YouTube 数据 API channels.list 方法。我已经使用“尝试我”页面首先检查响应

在此处输入图像描述

测试了此方法,现在当它尝试执行此操作时我自己打电话,使用它返回的 api 密钥。

https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCezJOfu7OtqGzd5xrP3q6WA&key=XXXXXXXXXXXXXXXXXXXXXXX

结果如下

{
  "error": {
    "code": 403,
    "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
    "errors": [
      {
        "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
        "domain": "youtube.quota",
        "reason": "quotaExceeded"
      }
    ]
  }
}

有人可以告诉我可能出了什么问题吗?我按照指示设置 api 密钥。然而它告诉我我已经超出了我的配额。

I am trying to access the YouTube data api channels.list method. I have tested this method using the Try me page first to check the response

enter image description here

Now when it try to make that my call myself Using an api key it returns.

https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCezJOfu7OtqGzd5xrP3q6WA&key=XXXXXXXXXXXXXXXXXXXXXXX

result below

{
  "error": {
    "code": 403,
    "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
    "errors": [
      {
        "message": "The request cannot be completed because you have exceeded your \u003ca href=\"/youtube/v3/getting-started#quota\"\u003equota\u003c/a\u003e.",
        "domain": "youtube.quota",
        "reason": "quotaExceeded"
      }
    ]
  }
}

Can someone tell me what could be wrong i am setting the api key as directed. Yet its telling me that i have exceeded my quota.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蹲在坟头点根烟 2025-01-23 12:19:15

我想说的第一件事是,您提出的请求是正确的。实际上,您似乎直接从 Google Developers 页面“尝试我”应用程序中复制了该应用程序。您所做的就是向其中添加您自己的 API 密钥。

我还可以通过错误消息得知您拥有有效的 api 密钥,并且您已启用 YouTube 数据 api。到目前为止,一切都很好,你做的一切都是正确的。

从你的问题语气来看,我觉得你根本没有让这个发挥作用。你总是会收到这个错误。所以我倾向于反对下面的第二个原因。

错误消息。

您的错误消息有两个可能的原因。它们都归结为这样一个事实:您需要配额才能针对 Google api 运行请求。不过,YouTube 数据 api 有一些不同类型的配额。 了解 YouTube api 配额

  1. 您运行了很多请求,只是用完了默认的 10k配额。解决办法:等到明天或者申请延期。
  2. 您的项目默认配额为0,因此您没有配额,需要申请延期。解决办法:申请延期。

你的配额是多少?

转到库下的谷歌云控制台,找到 YouTube 数据 api 并检查您的配额是多少。

输入图片这里的描述

如果你的配额显示为0,那是因为谷歌已经禁用了你项目中的API。我在谷歌的联系人一直不清楚为什么有些项目的配额被取消。唯一的解决办法就是申请延期。我个人在刚刚创建的项目中曾有过 YouTube 数据 api 配额为 0 的项目。如果我随后创建另一个新项目,那么我将获得 10k 配额。

您需要配额才能提出请求,如果您用完所有配额,则只需申请延期即可。如果您的配额为0,那么您需要申请配额延期。

问题论坛

在此处输入图像描述

The first thing i want to say is that you are making the request correctly. It actually looks like you copied the one directly out of Google Developers page try me app. All you did was add your own API key to it.

I can also tell by the error message that you have a valid api key, and that you have enabled the YouTube data api. So far so good you are doing everything right.

By the tone of your question it sounds to me like you have not gotten this to work at all. That you always get this error. So I am leaning wards cause number 2 below.

The error message.

There are two possible reasons for your error message. They both come down to the fact that you need quota to run requests against Google apis. YouTube data api has a bit of a diffrent type of quota though. Understanding YouTube api quota

  1. You have run a lot of requests and simply used up the default 10k quota. Solution: wait until tomorrow or apply for an extension.
  2. Your project has a default quota of 0. So you have no quota and need to apply for an extension. Solution: apply for an extension.

what is your quota?

Go to google cloud console under library find the YouTube data api and check what your quota is.

enter image description here

If your quota says 0 its because google has disabled the api in your project. My contacts at google have been unclear why some projects get their quota removed. The only solution is to apply for an extension. I have personally had projects with a YouTube data api quota of 0 on a project I just created. If I then create another new project then I will get the 10k quota.

You need quota to make requests, if you are using up all your quota then just apply for an extension. If your quota is 0 then you need quota apply for an extension.

Issue forum

enter image description here

女皇必胜 2025-01-23 12:19:15

在文档页面中使用尝试功能时,有时会出现配额错误 - 即使您没有检查 Google OAuth 2.0

话虽这么说,如果您不查询您的订阅或任何其他需要授权才能访问您的 YouTube 数据的数据,请不要选中 Google OAuth 2.0 选项。取消选中

如果错误仍然存​​在,请尝试以隐身模式发出请求,如果仍然存在,请尝试不同的查询,如果这也表明配额错误,请尝试等待几分钟。

最后,如果(经过所有这些测试)您仍然遇到此错误,请考虑停止使用尝试功能几个小时,因为它可能成为避免多次尝试的障碍来自您的 IP 地址的请求。

While using the try-it feature in the documentation page, sometimes the quota error raises - even if you don't have the Google OAuth 2.0 checked.

That being said, if you're not querying your subscriptions or any other data that requires authorization for access your YouTube data, leave the option Google OAuth 2.0 unchecked.

If the error continues, try make the request in incognito mode, if even there continues, try a different query, if that also says the quota error, try to wait a few minutes.

Finally, if (after all these tests) you still get this error, consider stop using the try-it feature for a few hours due it might be an barrier for avoid multiple requests from your IP address.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文