簡體   English   中英

當我插入Google G Suit時,為什么會收到Invalid Parent Orgunit Id的錯誤消息?

[英]Why do I get an error of Invalid Parent Orgunit Id when I'm inserting in Google G Suit?

在Google G Suit管理員中進行插入組織時,我收到了無效的父組織單位ID的錯誤。

我通過了真正的父級orgUnitid,但是仍然每次收到此錯誤響應時。

“代碼”:400,“消息”:“無效的父單位組織ID”

  • 這是我的代碼。

    在$ client-> setSubject()中,我通過了電子郵件地址

    C01sgPOLM1這是我的客戶ID PS:在這里,我通過了虛擬客戶ID以便進行參考。

     public function addOrgUnits() { $client = new Google_Client(); $client->useApplicationDefaultCredentials(); $client->addScope([ 'https://www.googleapis.com/auth/admin.directory.orgunit', ]); $client->setSubject('ABCD); $payload = [ 'name' => "demo1" ]; $httpClient = $client->authorize(); $response = $httpClient->post('https://www.googleapis.com/admin/directory/v1/customer/C01sgPOLM1/orgunits', $payload); if ($response->getStatusCode() == 200) { $users = json_decode($response->getBody()->getContents(), true); return $this->successResponse(trans('message.organizationFound'), ['data' => $users]); } return $this->errorResponse(); } 

我看到的行為與您在API測試器中所做的相同,這很奇怪,因為根據文檔,唯一必需的屬性是name 因此,根據文檔,您可以正確執行所有操作。 我現在唯一的猜測是API的行為方式已發生變化,否則可能是錯誤。 我建議您與G Suite API支持團隊聯系並報告此行為。

同時,要使其正常工作,您需要傳遞parentOrgUnitIdparentOrgUnitPath 我已經使用parentOrgUnitPath進行了測試,並且可以正常工作。

$payload = [
    'name' => "demo1",
    'parentOrgUnitPath' => "/"
];

我希望這有幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM