Skip to main content

schemas

Creates, updates, deletes, gets or lists a schemas resource.

Overview

Nameschemas
TypeResource
Idgoogleadmin.directory.schemas

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
displayNamestringDisplay name for the schema.
etagstringThe ETag of the resource.
fieldsarrayA list of fields in the schema.
kindstringKind of resource this is. (default: admin#directory#schema)
schemaIdstringThe unique identifier of the schema (Read-only)
schemaNamestringThe schema's name. Each schema_name must be unique within a customer. Reusing a name results in a 409: Entity already exists error.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcustomerId, schemaKeyRetrieves a schema.
listselectcustomerIdRetrieves all schemas for a customer.
insertinsertcustomerIdCreates a schema.
patchupdatecustomerId, schemaKeyPatches a schema.
updatereplacecustomerId, schemaKeyUpdates a schema.
deletedeletecustomerId, schemaKeyDeletes a schema.

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
schemaKeystring

SELECT examples

Retrieves a schema.

SELECT
displayName,
etag,
fields,
kind,
schemaId,
schemaName
FROM googleadmin.directory.schemas
WHERE customerId = '{{ customerId }}' -- required
AND schemaKey = '{{ schemaKey }}' -- required;

INSERT examples

Creates a schema.

INSERT INTO googleadmin.directory.schemas (
data__schemaId,
data__schemaName,
data__fields,
data__displayName,
data__kind,
data__etag,
customerId
)
SELECT
'{{ schemaId }}',
'{{ schemaName }}',
'{{ fields }}',
'{{ displayName }}',
'{{ kind }}',
'{{ etag }}',
'{{ customerId }}'
RETURNING
displayName,
etag,
fields,
kind,
schemaId,
schemaName
;

UPDATE examples

Patches a schema.

UPDATE googleadmin.directory.schemas
SET
data__schemaId = '{{ schemaId }}',
data__schemaName = '{{ schemaName }}',
data__fields = '{{ fields }}',
data__displayName = '{{ displayName }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}'
WHERE
customerId = '{{ customerId }}' --required
AND schemaKey = '{{ schemaKey }}' --required
RETURNING
displayName,
etag,
fields,
kind,
schemaId,
schemaName;

REPLACE examples

Updates a schema.

REPLACE googleadmin.directory.schemas
SET
data__schemaId = '{{ schemaId }}',
data__schemaName = '{{ schemaName }}',
data__fields = '{{ fields }}',
data__displayName = '{{ displayName }}',
data__kind = '{{ kind }}',
data__etag = '{{ etag }}'
WHERE
customerId = '{{ customerId }}' --required
AND schemaKey = '{{ schemaKey }}' --required
RETURNING
displayName,
etag,
fields,
kind,
schemaId,
schemaName;

DELETE examples

Deletes a schema.

DELETE FROM googleadmin.directory.schemas
WHERE customerId = '{{ customerId }}' --required
AND schemaKey = '{{ schemaKey }}' --required;