google directory api - org name of root org unit path

2.3k views Asked by At

I am trying to get the organization name of root organization. However in the below API, I cannot send orgUnitPath as empty.

https://developers.google.com/admin-sdk/directory/v1/reference/orgunits/get

Any idea on how to achieve this?

2

There are 2 answers

3
Jay Lee On

The root org is always named '/' via the API no matter what it's called in the Control Panel.

2
Adam Nerell On

Old topic, but I might just as well answer, as I was looking myself. You can get the root OU, in at least one way, it's not pretty, but it works.

First you use Orgunits: list to get a complete list of the units. The you loop through them until you find a unit with parentPath="/". Then you take the parentId of that unit and do a Orgunits: get using said "parentId" as "orgUnitPath".

Voila... /Adam