排解 Directory API 問題
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明經銷商使用 Directory API 時可能遇到的一些常見問題。
400:badRequest
如果傳遞至方法中的參數值不正確,就會發生這個錯誤。
如果使用 users.get
方法,請確認傳遞至 userKey
參數的值是使用者的主要電子郵件地址、別名電子郵件地址或專屬使用者 ID。
如果使用 users.list
方法,請驗證下列參數:
customer
參數:請只使用 Google 產生的 customerId
。請勿使用實際的客戶網域。建議您使用這個參數,因為如果客戶有次要網域,使用 domain
參數只會傳回該特定網域中具有電子郵件地址的使用者。
domain
參數:請只使用實際的客戶網域。請勿使用 Google 生成的
customerId
。
403:domainCannotUseApis
如果客戶停用經銷商的 Admin SDK API 存取權,就會發生這項錯誤。如要解決這個問題,請要求客戶重新啟用 Admin SDK API 的存取權。詳情請參閱「控管 API 存取權」。
如果您嘗試取得目前授權使用者人數時收到這項錯誤,請使用訂閱資源中的 licensedNumberOfSeats
欄位,而非呼叫 users.list
方法。
403:forbidden
如果您不擁有客戶,或是客戶已停用經銷商的管理控制台存取權,就會發生這個錯誤。
如要解決這個問題,請先呼叫 customers.get
方法,再呼叫驗證客戶經銷商擁有權的方法,或請客戶重新啟用經銷商對管理控制台的存取權。詳情請參閱「存取客戶的管理控制台」。
如果 Google Cloud 專案未啟用 API,就會發生這個錯誤。如要解決這個問題,請前往 Google Cloud 控制台並啟用 API。詳情請參閱「啟用 Google Workspace API」。
409:duplicate
嘗試新增使用者時,如果客戶的主要電子郵件地址已存在於下列任一位置,就會發生這項錯誤:
- 您要將他們新增至的現有 Google Workspace 帳戶。
- 其他 Google 產品 (非 Google Workspace)。
請按照下列步驟解決這個問題:
呼叫 users.get
方法。
如果收到 200
回應,表示使用者已存在於客戶的 Google Workspace 帳戶中。您無法將這位使用者新增至帳戶。
如果收到 403 forbidden
回應,表示主要電子郵件參數中的網域不是轉售客戶,或是主要電子郵件先前已用於其他 Google 產品,因此必須先驗證客戶的網域,才能順利新增使用者。
如果可以驗證客戶的網域,請按照下列步驟操作:
- 使用
users.insert
方法建立臨時管理員使用者,然後繼續佈建,直到完成最後的網域驗證步驟。
- 驗證網域時,請將臨時使用者新增至
webResource.insert
呼叫的要求主體 owners[]
參數。
請撥打這通電話,直到收到 200
回覆為止。
- 網域通過驗證後,請使用
users.patch
或 users.update
方法重新命名臨時使用者名稱。
如果無法驗證客戶的網域,請按照下列步驟操作:
- 使用
users.insert
方法建立臨時管理員使用者。
- 請客戶以臨時使用者身分登入,並透過管理控制台驗證網域。
- 網域通過驗證後,客戶或您都可以重新命名臨時使用者名稱。您可以使用
users.patch
或 users.update
方法。
412:limitExceeded
如果客戶已達到帳戶名額上限,就會發生這個錯誤。如要解決這個問題,請使用 subscriptions.changeSeats
方法,並根據訂閱方案採取下列行動:
- 如要增加
FLEXIBLE
,請增加 maximumNumberOfSeats
參數。
- 如要增加
ANNUAL
,請增加 numberOfSeats
參數。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[],[],null,["# Troubleshoot Directory API issues\n\nThis page describes some common issues that you might encounter involving the\nDirectory API as a reseller.\n\n`400:badRequest`\n----------------\n\nThis error occurs when an incorrect parameter value is passed into the method.\n\nIf using the `users.get` method, verify that the value passed into the `userKey`\nparameter is either the user's primary email address, alias email address, or\nunique user ID.\n\nIf using the `users.list` method, verify the following parameters:\n\n- `customer` parameter: Only use the `customerId` that was generated by Google. Don't use the actual customer's domain. We recommend using this parameter because if a customer has secondary domains, using the `domain` parameter only returns users with email addresses on that particular domain.\n- `domain` parameter: Only use the actual customer's domain. Don't use the \n `customerId` that was generated by Google.\n\n`403:domainCannotUseApis`\n-------------------------\n\nThis error occurs when your customer has disable reseller access to the\nAdmin SDK API. To resolve this issue, ask your customer to re-enable access to\nthe Admin SDK API. For more information, see\n[Control API access](https://support.google.com/a/answer/60757).\n\nIf you're trying to get the count of current licensed users and you get this\nerror, instead of calling the `users.list` method, use the `licensedNumberOfSeats` field\nfrom the subscription resource.\n\n`403:forbidden`\n---------------\n\nThis error occurs when you don't own the customer or your customer has disabled\nreseller access to their Admin console.\n\nTo resolve this issue, either call the\n[`customers.get` method](/workspace/admin/reseller/v1/reference/customers/get)\nbefore making calls to verify reseller ownership of customer or ask your\ncustomer to re-enable reseller access to their Admin console. For more\ninformation, see\n[Access a customer's Admin console](https://support.google.com/work/reseller/answer/6184379).\n\n`403:usageLimits.accessNotConfigured`\n-------------------------------------\n\nThis error occurs when the API isn't enabled in the Google Cloud project. To resolve\nthis issue, go to the Google Cloud console, and enable the API. For more\ninformation, see\n[Enable Google Workspace APIs](/workspace/guides/enable-apis).\n\n`409:duplicate`\n---------------\n\nThis error occurs when you're trying to add a new user, but the customer's\nprimary email already exists within one of the following:\n\n- Current Google Workspace account that you're trying to add them to.\n- Another Google product (not Google Workspace).\n\nTo resolve this issue, do the following:\n\n1. Call the `users.get` method.\n\n If you get a `200` response, then the user already exists in the customer's\n Google Workspace Account. You can't add this user to the account.\n\n If you get a `403 forbidden` response, then either the domain in the primary\n email parameter isn't a resold customer or the primary email has been used\n previously for a different Google product and the customer's domain must\n first be verified before this user can successfully be added.\n2. If you can verify the customer's domain, do the following:\n\n 1. Create a temporary admin user using the [`users.insert` method](/workspace/admin/directory/v1/reference/users/insert) and continue provisioning to the final domain verification step.\n 2. When verifying the domain, add the temporary users into the `owners[]` parameter of the request body for the [`webResource.insert` call](/site-verification/v1/webResource/insert). Make this call until you receive a `200` response.\n 3. After the domain is verified, rename the temporary username by using either the [`users.patch`](/workspace/admin/directory/v1/reference/users/patch) or the [`users.update`](/workspace/admin/directory/reference/rest/v1/users/update) methods.\n3. If you can't verify the customer's domain, do the following:\n\n 1. Create a temporary admin user using the [`users.insert` method](/workspace/admin/directory/v1/reference/users/insert).\n 2. Have your customer sign in as the temporary user and verify their domain through the Admin console.\n 3. After the domain is verified, either the customer or you can rename the temporary username. You can use either the [`users.patch`](/workspace/admin/directory/v1/reference/users/patch) or the [`users.update`](/workspace/admin/directory/reference/rest/v1/users/update) methods.\n\n`412:limitExceeded`\n-------------------\n\nThis error occurs when your customer has reached their maximum seat limit. To\nresolve this issue, Use the [`subscriptions.changeSeats` method](/workspace/admin/reseller/v1/reference/subscriptions/changeSeats)\nand depending on their subscription plan, use the following:\n\n- For `FLEXIBLE`, increase the `maximumNumberOfSeats` parameter.\n- For `ANNUAL`, increase the `numberOfSeats` parameter."]]