Skip to main content

orgunits

Creates, updates, deletes, gets or lists an orgunits resource.

Overview

Nameorgunits
TypeResource
Idgoogleadmin.directory.orgunits

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringThe organizational unit's path name. For example, an organizational unit's name within the /corp/support/sales_support parent path is sales_support. Required.
blockInheritancebooleanThis field is deprecated and setting its value has no effect.
descriptionstringDescription of the organizational unit.
etagstringETag of the resource.
kindstringThe type of the API resource. For Orgunits resources, the value is admin#directory#orgUnit. (default: admin#directory#orgUnit)
orgUnitIdstringThe unique ID of the organizational unit.
orgUnitPathstringThe full path to the organizational unit. The orgUnitPath is a derived property. When listed, it is derived from parentOrgunitPath and organizational unit's name. For example, for an organizational unit named 'apps' under parent organization '/engineering', the orgUnitPath is '/engineering/apps'. In order to edit an orgUnitPath, either update the name of the organization or the parentOrgunitPath. A user's organizational unit determines which Google Workspace services the user has access to. If the user is moved to a new organization, the user's access changes. For more information about organization structures, see the administration help center. For more information about moving a user to a different organization, see Update a user.
parentOrgUnitIdstringThe unique ID of the parent organizational unit. Required, unless parentOrgUnitPath is set.
parentOrgUnitPathstringThe organizational unit's parent path. For example, /corp/sales is the parent path for /corp/sales/sales_support organizational unit. Required, unless parentOrgUnitId is set.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcustomerId, orgunitsIdRetrieves an organizational unit.
listselectcustomerIdorgUnitPath, typeRetrieves a list of all organizational units for an account.
insertinsertcustomerIdAdds an organizational unit.
patchupdatecustomerId, orgunitsIdUpdates an organizational unit. This method supports patch semantics
updatereplacecustomerId, orgunitsIdUpdates an organizational unit.
deletedeletecustomerId, orgunitsIdRemoves an organizational unit.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
customerIdstring
orgunitsIdstring
orgUnitPathstring
typestring

SELECT examples

Retrieves an organizational unit.

SELECT
name,
blockInheritance,
description,
etag,
kind,
orgUnitId,
orgUnitPath,
parentOrgUnitId,
parentOrgUnitPath
FROM googleadmin.directory.orgunits
WHERE customerId = '{{ customerId }}' -- required
AND orgunitsId = '{{ orgunitsId }}' -- required;

INSERT examples

Adds an organizational unit.

INSERT INTO googleadmin.directory.orgunits (
data__kind,
data__name,
data__description,
data__etag,
data__blockInheritance,
data__orgUnitId,
data__orgUnitPath,
data__parentOrgUnitId,
data__parentOrgUnitPath,
customerId
)
SELECT
'{{ kind }}',
'{{ name }}',
'{{ description }}',
'{{ etag }}',
{{ blockInheritance }},
'{{ orgUnitId }}',
'{{ orgUnitPath }}',
'{{ parentOrgUnitId }}',
'{{ parentOrgUnitPath }}',
'{{ customerId }}'
RETURNING
name,
blockInheritance,
description,
etag,
kind,
orgUnitId,
orgUnitPath,
parentOrgUnitId,
parentOrgUnitPath
;

UPDATE examples

Updates an organizational unit. This method supports patch semantics

UPDATE googleadmin.directory.orgunits
SET
data__kind = '{{ kind }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__etag = '{{ etag }}',
data__blockInheritance = {{ blockInheritance }},
data__orgUnitId = '{{ orgUnitId }}',
data__orgUnitPath = '{{ orgUnitPath }}',
data__parentOrgUnitId = '{{ parentOrgUnitId }}',
data__parentOrgUnitPath = '{{ parentOrgUnitPath }}'
WHERE
customerId = '{{ customerId }}' --required
AND orgunitsId = '{{ orgunitsId }}' --required
RETURNING
name,
blockInheritance,
description,
etag,
kind,
orgUnitId,
orgUnitPath,
parentOrgUnitId,
parentOrgUnitPath;

REPLACE examples

Updates an organizational unit.

REPLACE googleadmin.directory.orgunits
SET
data__kind = '{{ kind }}',
data__name = '{{ name }}',
data__description = '{{ description }}',
data__etag = '{{ etag }}',
data__blockInheritance = {{ blockInheritance }},
data__orgUnitId = '{{ orgUnitId }}',
data__orgUnitPath = '{{ orgUnitPath }}',
data__parentOrgUnitId = '{{ parentOrgUnitId }}',
data__parentOrgUnitPath = '{{ parentOrgUnitPath }}'
WHERE
customerId = '{{ customerId }}' --required
AND orgunitsId = '{{ orgunitsId }}' --required
RETURNING
name,
blockInheritance,
description,
etag,
kind,
orgUnitId,
orgUnitPath,
parentOrgUnitId,
parentOrgUnitPath;

DELETE examples

Removes an organizational unit.

DELETE FROM googleadmin.directory.orgunits
WHERE customerId = '{{ customerId }}' --required
AND orgunitsId = '{{ orgunitsId }}' --required;