用量限额和配额
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
限额和配额可保护 Google 的基础架构免受自动流程以不当方式使用 Reseller API 所造成的影响。API 请求过多可能是由于无害的拼写错误所致,也可能是由于低效系统进行不必要的 API 调用所致。无论是何种原因,您都应在来自特定来源的流量达到某一级别时阻止该流量,这是保证 Google Workspace 系统总体运行良好所必需的。这一设置可确保一个开发者的行为所造成的负面影响不会波及更大范围的开发者群体。
API 请求失败
在极少数情况下,您的 API 请求会失败,此时您的应用会收到 HTTP 状态代码响应。状态代码 403
包含有关输入不正确的错误信息,而 HTTP 状态代码 503
包含错误信息,指明哪些 API 配额已超出。通过这些响应,您的自定义应用可以检测到这些错误并采取适当的操作。
基于时间的错误
对于所有基于时间的错误(每个线程每 N 秒最多 N 个),尤其是 503
状态代码错误,我们建议您的代码捕获异常,并使用指数退避算法等待一小段时间,然后再重试失败的调用。一个线程的 Reseller API 示例是等待 5 秒,然后重试失败的调用。如果请求成功,请针对其他线程重复此模式。如果第二次请求不成功,您的应用应减少请求频率,直到调用成功为止。例如,将初始 5 秒延迟时间增加到 10 秒,然后再次重试失败的调用。此外,还要确定重试限制。
例如,在应用向用户返回错误之前,以不同的延迟时间重试请求 5 到 7 次。
限制
API 限额类别 |
限制 |
订阅 purchaseOrderId |
此属性最多可接受 80 个纯文本字符。 |
订阅 maxResults |
maxResults 查询字符串可以是 1 到 100 个结果。
默认值为 20 个结果。
|
转移令牌 (customerAuthToken ) |
客户的转移令牌在生成后 30 天内有效。
|
客户的用户人数上限 |
根据您的合同,用户数上限可以是 5 万,也可以是经销商合同中规定的上限。
|
未经授权的请求 |
Google 不允许向 Reseller API 发送未经授权的请求。
如果未提供授权令牌,则相应请求会被视为未经授权。如需了解详情,请参阅了解身份验证和授权。
|
其他类型的限制
其他类型的限制 |
限制和准则 |
数据格式 |
数据格式为 JavaScript 对象表示法 JSON。
JSON 是一种常见的互联网格式,可用于表示任意数据结构。JSON 是一种完全独立于语言的文本格式,但它使用的惯例对于 C 系列语言(包括 C、C++、C#、Java、JavaScript、Perl 和 Python)的程序员来说非常熟悉。
|
时间格式 |
所有日期时间均以毫秒为单位,采用纪元转换器。此格式适用于订阅创建时间、方案的承诺开始时间和结束时间以及 30 天免费试用期的结束时间的值。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["# Usage limits and quotas\n\n\u003cbr /\u003e\n\nLimits and quotas protect the Google infrastructure from an automated process\nthat uses the Reseller API in an inappropriate way. Excessive requests from\nan API might result from a harmless typo, or might result from an inefficiently\ndesigned system that makes needless API calls. Regardless of the cause,\nblocking traffic from a specific source when it reaches a certain level is\nnecessary for the overall health of the Google Workspace system. It ensures that\none developer's actions can not negatively impact the larger community.\n\nAPI request failures\n--------------------\n\nIn the unlikely event that your API request fails, your application receives an\nHTTP status code response. A status code of `403` has error\ninformation about incorrect input and an HTTP status code of `503`\nhas error information indicating which API quotas have been exceeded. These\nresponses let your custom application detect these errors and take appropriate\naction.\n\nTime-based errors\n-----------------\n\nFor all errors that are time based (maximum of N things for N seconds per\nthread), especially the `503` status code errors, we recommend that\nyour code catch the exception and by using\nan\n[exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff)\nalgorithm, wait for a small delay before retrying the failed call. A\nReseller API example for one thread\nis to wait 5 seconds and retry the failed call. If the request is successful,\nrepeat this pattern for the other threads. If the second request isn't\nsuccessful, your application should scale back on the frequency of the request\nuntil a call is successful. For example, increase the initial 5 second delay\nto 10 seconds and retry your failed call again. Also, decide on a retry limit.\nFor example retry a request 5 to 7 times with different delay times before\nyour application returns an error to the user.\n\nLimits\n------\n\n| API limit categories | Limits |\n|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Subscription `purchaseOrderId` | This property accepts up to 80 plain text characters. |\n| Subscription `maxResults` | The `maxResults` query string can be 1 - 100 results. The default is 20 results. |\n| Transfer Token (`customerAuthToken`) | A customer's transfer token is valid for 30 days after it's generated. |\n| Maximum number of users for a customer | Depending on your contract, the maximum number of users can either be 50,000 or the maximum defined in your reseller contract. |\n| Unauthorized requests | Google doesn't allow unauthorized requests to the Reseller API. A request is considered unauthorized if no authorization token is provided. For more information, see [Learn about authentication \\& authorization](/workspace/guides/auth-overview). |\n\nOther types of limits\n---------------------\n\n| Other types of limits | Limitations and guidelines |\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Data format | The data format is in the JavaScript Object Notation [JSON](https://wikipedia.org/wiki/JSON). \u003cbr /\u003e \u003cbr /\u003e JSON is a common internet format that provides a method of representing arbitrary data structures. JSON is a text format that is completely language-independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, and Python. |\n| Time format | All date times are in the [Epoch converter](https://www.epochconverter.com/) in milliseconds. This format applies to the values for the subscription creation time, a plan's commitment start and end times, and a 30 day free trial's end time. |"]]