用量限制和配額
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
限制和配額可避免自動化程序以不當方式使用 Reseller API,進而保護 Google 基礎架構。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 天內有效。
|
每個客戶的使用者人數上限 |
視合約而定,使用者人數上限為 50,000 人,或經銷商合約中定義的上限。
|
未授權要求 |
Google 不允許未經授權的要求存取 Reseller API。
如果未提供授權權杖,系統會將要求視為未經授權。詳情請參閱「瞭解驗證和授權」。 |
其他限制類型
其他限制類型 |
限制和規範 |
資料格式 |
資料格式為 JavaScript Object Notation (JSON)JSON。
JSON 是常見的網際網路格式,可代表任意資料結構。JSON 是一種與語言完全無關的文字格式,但使用的慣例是 C 系列語言 (包括 C、C++、C#、Java、JavaScript、Perl 和 Python) 的程式設計師所熟悉。 |
時間格式 |
所有日期時間均以 Epoch 轉換器的毫秒為單位。這個格式適用於訂閱建立時間、方案的約期開始和結束時間,以及 30 天免費試用期結束時間。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間: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. |"]]