【发布时间】:2018-07-31 11:07:06
【问题描述】:
在 Google G Suit 管理员中插入组织时,我收到 Invalid Parent Orgunit Id 的错误。
我传递了真正的父 orgUnitid,但每次收到此错误响应时仍然如此。
"code": 400, "message": "Invalid Parent Orgunit Id"
-
这是我的代码。
在 $client->setSubject() 中我传递了电子邮件地址
C01sgPOLM1 这是我的客户 ID : 在这里我传递了虚拟客户 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(); }
【问题讨论】:
-
你的代码在哪里?这真的没有帮助。
-
请edit 成为主题的问题:包括一个重复问题的Minimal, Complete, and Verifiable example。寻求调试帮助的问题(“为什么这段代码不能按我想要的方式工作?”)必须包括:(1)期望的行为,(2)特定的问题或错误,以及(3)重现它所需的最短代码问题本身。另请参阅:What topics can I ask about here? 和 How to Ask
-
我编辑了问题
标签: google-api-php-client google-admin-sdk google-workspace google-visualization