用量限制和配額
限制和配額可以保護 Google 基礎架構,使其無法自動化處理程序以不當方式使用 Developer API。API 發出太多要求時,有可能是無害的錯字,或是因為效率不佳的系統造成不需要的 API 呼叫。無論原因為何,為了保障 Google Workspace 系統的整體健康狀態,在來源達到特定等級時,必須封鎖來自該來源的流量。這樣才能確保開發人員的動作不會對更廣大的社群造成負面影響。
API 要求失敗
萬一 API 要求失敗,應用程式會收到 HTTP 狀態碼回應。403
狀態碼包含錯誤輸入相關錯誤資訊,而 503
的 HTTP 狀態碼含有錯誤資訊,指出已超過哪個 API 配額。這些回應可讓自訂應用程式偵測這些錯誤並採取適當行動。
時間方面的錯誤
針對所有根據時間發生的錯誤 (每個執行緒 N 秒最多 N 秒),特別是 503
狀態碼錯誤,建議您讓程式碼擷取例外狀況,並使用指數輪詢演算法,等待一小段延遲時間再重試失敗的呼叫。其中一個執行緒的 Reseller API 範例為等待 5 秒,然後重試失敗的呼叫。如果要求成功,請針對其他執行緒重複這個模式。如果第二個要求失敗,應用程式應根據要求的頻率縮減資源,直到呼叫成功為止。例如,將初始 5 秒延遲時間提高至 10 秒,然後再次重試失敗的呼叫。此外,請決定重試限制。例如,在不同的延遲時間之間重試要求 5 到 7 次,直到應用程式將錯誤傳回給使用者。
限制
API 限制類別 |
限制 |
訂閱 purchaseOrderId |
此屬性接受最多 80 個純文字字元。 |
訂閱 maxResults |
maxResults 查詢字串可以是 1 到 100 筆結果。預設值為 20 筆結果。 |
轉移權杖 (customerAuthToken ) |
客戶的轉移權杖在產生後的 30 天內有效。
|
單一客戶的使用者人數上限 |
視您的合約而定,使用者人數上限可以是 50,000 人,或是經銷商合約中定義的人數上限。
|
未獲授權的要求 |
Google 不允許未經授權的向經銷商 API 提出要求。
如未提供授權權杖,系統會將要求視為未授權。詳情請參閱「瞭解驗證和授權」一文。 |
其他限制類型
其他限制類型 |
限制和規範 |
資料格式 |
資料格式採用 JavaScript 物件標記法 JSON。
JSON 是常見的網際網路格式,可呈現任意資料結構的方法。JSON 是完全與語言無關的文字格式,但使用 C、C++、C#、Java、JavaScript、Perl 和 Python 等 C 系列程式設計師都熟悉的慣例。 |
時間格式 |
所有日期時間都以毫秒為單位的 Epoch 紀元轉換器。這種格式適用於訂閱建立時間的值、方案的承諾使用合約開始與結束時間,以及 30 天免費試用期的結束時間。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-02-28 (世界標準時間)。
[null,null,["上次更新時間:2024-02-28 (世界標準時間)。"],[[["Google Workspace API quotas and limits safeguard the platform's infrastructure by preventing excessive or inappropriate usage that could negatively impact overall system performance."],["When API requests fail due to incorrect input or quota exceedances, HTTP status codes like 403 and 503 are returned, enabling developers to implement error handling and retry mechanisms."],["Time-based errors, especially those indicated by a 503 status code, should be addressed using exponential backoff, gradually increasing retry delays to avoid overwhelming the system."],["Specific limitations apply to various aspects of the Reseller API, including request parameters, data formats, and user counts, which are outlined in detail for developers to adhere to."],["Developers must ensure all Reseller API requests are authorized with a valid token, as unauthorized requests are strictly prohibited to maintain security and integrity."]]],["The Reseller API employs limits and quotas to ensure system health and prevent abuse. API failures, indicated by HTTP status codes `403` or `503`, require handling. `503` errors, suggesting quota exceedance, necessitate implementing exponential backoff: pausing and retrying. Limits include `purchaseOrderId` character limits, `maxResults` query ranges, 30-day transfer token validity, and user caps. Data uses JSON format, with time represented in Epoch milliseconds. Unauthorized requests without an authorization token are not permitted.\n"]]