Skip to main content

document_schemas

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

Overview​

Namedocument_schemas
TypeResource
Idgoogle.contentwarehouse.document_schemas

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe resource name of the document schema. Format: projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}. The name is ignored when creating a document schema.
createTimestring (google-datetime)Output only. The time when the document schema is created.
descriptionstringSchema description.
displayNamestringRequired. Name of the schema given by the user. Must be unique per project.
documentIsFolderbooleanDocument Type, true refers the document is a folder, otherwise it is a typical document.
propertyDefinitionsarrayDocument details.
updateTimestring (google-datetime)Output only. The time when the document schema is last updated.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, documentSchemasIdGets a document schema. Returns NOT_FOUND if the document schema does not exist.
listselectprojectsId, locationsIdpageSize, pageTokenLists document schemas.
createinsertprojectsId, locationsIdCreates a document schema.
patchupdateprojectsId, locationsId, documentSchemasIdUpdates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the EnumTypeOptions.validation_check_disabled flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.
deletedeleteprojectsId, locationsId, documentSchemasIdDeletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.

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
documentSchemasIdstring
locationsIdstring
projectsIdstring
pageSizeinteger (int32)
pageTokenstring

SELECT examples​

Gets a document schema. Returns NOT_FOUND if the document schema does not exist.

SELECT
name,
createTime,
description,
displayName,
documentIsFolder,
propertyDefinitions,
updateTime
FROM google.contentwarehouse.document_schemas
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND documentSchemasId = '{{ documentSchemasId }}' -- required
;

INSERT examples​

Creates a document schema.

INSERT INTO google.contentwarehouse.document_schemas (
data__description,
data__displayName,
data__documentIsFolder,
data__name,
data__propertyDefinitions,
projectsId,
locationsId
)
SELECT
'{{ description }}',
'{{ displayName }}',
{{ documentIsFolder }},
'{{ name }}',
'{{ propertyDefinitions }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
createTime,
description,
displayName,
documentIsFolder,
propertyDefinitions,
updateTime
;

UPDATE examples​

Updates a Document Schema. Returns INVALID_ARGUMENT if the name of the Document Schema is non-empty and does not equal the existing name. Supports only appending new properties, adding new ENUM possible values, and updating the EnumTypeOptions.validation_check_disabled flag for ENUM possible values. Updating existing properties will result into INVALID_ARGUMENT.

UPDATE google.contentwarehouse.document_schemas
SET
data__documentSchema = '{{ documentSchema }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND documentSchemasId = '{{ documentSchemasId }}' --required
RETURNING
name,
createTime,
description,
displayName,
documentIsFolder,
propertyDefinitions,
updateTime;

DELETE examples​

Deletes a document schema. Returns NOT_FOUND if the document schema does not exist. Returns BAD_REQUEST if the document schema has documents depending on it.

DELETE FROM google.contentwarehouse.document_schemas
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND documentSchemasId = '{{ documentSchemasId }}' --required
;