如Admin SDK Directory Service提到
謝謝,開發人員可以使用管理SDK的API目錄中的Apps腳本。此API爲Google Apps域(包括經銷商)的管理員提供管理其域中的設備,組,用戶和其他實體的能力。
使用Directory API,您可以使用GET
請求retrieve an organization unit,幷包含Authorize requests中描述的授權。 orgUnitPath
查詢字符串是此組織單位的完整路徑。
文檔中還討論:
如果你是管理員檢索組織單位,使用my_customer
。
GET https://www.googleapis.com/admin/directory/v1/customer/my_customer/orgunits/orgUnitPath
如果你是一個經銷商檢索的組織單位爲經銷商客戶,使用customerId
。要獲取customerId
,請使用Retrieve a user操作。
GET https://www.googleapis.com/admin/directory/v1/customer/customerId/orgunits/orgUnitPath
如果你想seperately打印,這裏有一個例子請求,其中,「一線銷售」組織單位檢索。請注意請求URI中的'前線+銷售'HTTP編碼:
GET https://www.googleapis.com/admin/directory/v1/customer/my_customer/orgunits/corp/sales/frontline+sales
成功的響應將返回HTTP 200狀態碼。與狀態代碼一起,響應返回組織單位的設置:
{
"kind": "directory#orgUnit",
"name": "frontline sales",
"description": "The frontline sales team",
"orgUnitPath": "/corp/sales/frontline sales",
"parentOrgUnitPath": "/corp/sales",
"blockInheritance": false
}
希望幫助!
我沒有得到如上的輸出。 但我無法從上述輸出中訪問各個值。例如,假設上面的輸出存儲在變量'CN'中,如果我打印** CN.name **,它將顯示未定義的輸出。你可以幫我嗎。提前致謝。 – Kanchan