orgunits
Creates, updates, deletes, gets or lists an orgunits
resource.
Overview
Name | orgunits |
Type | Resource |
Id | googleadmin.directory.orgunits |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The organizational unit's path name. For example, an organizational unit's name within the /corp/support/sales_support parent path is sales_support. Required. |
blockInheritance | boolean | This field is deprecated and setting its value has no effect. |
description | string | Description of the organizational unit. |
etag | string | ETag of the resource. |
kind | string | The type of the API resource. For Orgunits resources, the value is admin#directory#orgUnit . (default: admin#directory#orgUnit) |
orgUnitId | string | The unique ID of the organizational unit. |
orgUnitPath | string | The 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. |
parentOrgUnitId | string | The unique ID of the parent organizational unit. Required, unless parentOrgUnitPath is set. |
parentOrgUnitPath | string | The 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. |
Successful response
Name | Datatype | Description |
---|---|---|
etag | string | ETag of the resource. |
kind | string | The type of the API resource. For Org Unit resources, the type is admin#directory#orgUnits . (default: admin#directory#orgUnits) |
organizationUnits | array | A list of organizational unit objects. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | customerId , orgunitsId | Retrieves an organizational unit. | |
list | select | customerId | orgUnitPath , type | Retrieves a list of all organizational units for an account. |
insert | insert | customerId | Adds an organizational unit. | |
patch | update | customerId , orgunitsId | Updates an organizational unit. This method supports patch semantics | |
update | replace | customerId , orgunitsId | Updates an organizational unit. | |
delete | delete | customerId , orgunitsId | Removes 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.
Name | Datatype | Description |
---|---|---|
customerId | string | |
orgunitsId | string | |
orgUnitPath | string | |
type | string |
SELECT
examples
- get
- list
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;
Retrieves a list of all organizational units for an account.
SELECT
etag,
kind,
organizationUnits
FROM googleadmin.directory.orgunits
WHERE customerId = '{{ customerId }}' -- required
AND orgUnitPath = '{{ orgUnitPath }}'
AND type = '{{ type }}';
INSERT
examples
- insert
- Manifest
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
;
# Description fields are for documentation purposes
- name: orgunits
props:
- name: customerId
value: string
description: Required parameter for the orgunits resource.
- name: kind
value: string
description: >
The type of the API resource. For Orgunits resources, the value is `admin#directory#orgUnit`.
default: admin#directory#orgUnit
- name: name
value: string
description: >
The organizational unit's path name. For example, an organizational unit's name within the /corp/support/sales_support parent path is sales_support. Required.
- name: description
value: string
description: >
Description of the organizational unit.
- name: etag
value: string
description: >
ETag of the resource.
- name: blockInheritance
value: boolean
description: >
This field is deprecated and setting its value has no effect.
- name: orgUnitId
value: string
description: >
The unique ID of the organizational unit.
- name: orgUnitPath
value: string
description: >
The 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](https://support.google.com/a/answer/4352075). For more information about moving a user to a different organization, see [Update a user](https://developers.google.com/workspace/admin/directory/v1/guides/manage-users.html#update_user).
- name: parentOrgUnitId
value: string
description: >
The unique ID of the parent organizational unit. Required, unless `parentOrgUnitPath` is set.
- name: parentOrgUnitPath
value: string
description: >
The 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.
UPDATE
examples
- patch
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
- update
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
- delete
Removes an organizational unit.
DELETE FROM googleadmin.directory.orgunits
WHERE customerId = '{{ customerId }}' --required
AND orgunitsId = '{{ orgunitsId }}' --required;