documents
Creates, updates, deletes, gets or lists a documents
resource.
Overview
Name | documents |
Type | Resource |
Id | google.contentwarehouse.documents |
Fields
The following fields are returned by SELECT
queries:
- get
Successful response
Name | Datatype | Description |
---|---|---|
name | string | The resource name of the document. Format: projects/{project_number}/locations/{location}/documents/{document_id}. The name is ignored when creating a document. |
cloudAiDocument | object | Document AI format to save the structured content, including OCR. (id: GoogleCloudDocumentaiV1Document) |
contentCategory | string | Indicates the category (image, audio, video etc.) of the original content. |
createTime | string (google-datetime) | Output only. The time when the document is created. |
creator | string | The user who creates the document. |
displayName | string | Required. Display name of the document given by the user. This name will be displayed in the UI. Customer can populate this field with the name of the document. This differs from the 'title' field as 'title' is optional and stores the top heading in the document. |
displayUri | string | Uri to display the document, for example, in the UI. |
dispositionTime | string (google-datetime) | Output only. If linked to a Collection with RetentionPolicy, the date when the document becomes mutable. |
documentSchemaName | string | The Document schema name. Format: projects/{project_number}/locations/{location}/documentSchemas/{document_schema_id}. |
inlineRawDocument | string (byte) | Raw document content. |
legalHold | boolean | Output only. Indicates if the document has a legal hold on it. |
plainText | string | Other document format, such as PPTX, XLXS |
properties | array | List of values that are user supplied metadata. |
rawDocumentFileType | string | This is used when DocAI was not used to load the document and parsing/ extracting is needed for the inline_raw_document. For example, if inline_raw_document is the byte representation of a PDF file, then this should be set to: RAW_DOCUMENT_FILE_TYPE_PDF. |
rawDocumentPath | string | Raw document file in Cloud Storage path. |
referenceId | string | The reference ID set by customers. Must be unique per project and location. |
textExtractionDisabled | boolean | If true, text extraction will not be performed. |
textExtractionEnabled | boolean | If true, text extraction will be performed. |
title | string | Title that describes the document. This can be the top heading or text that describes the document. |
updateTime | string (google-datetime) | Output only. The time when the document is last updated. |
updater | string | The user who lastly updates the document. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , documentsId | Gets a document. Returns NOT_FOUND if the document does not exist. | |
create | insert | projectsId , locationsId | Creates a document. | |
patch | update | projectsId , locationsId , documentsId | Updates a document. Returns INVALID_ARGUMENT if the name of the document is non-empty and does not equal the existing name. | |
delete | delete | projectsId , locationsId , documentsId | Deletes a document. Returns NOT_FOUND if the document does not exist. | |
set_acl | exec | projectsId , locationsId , documentsId | Sets the access control policy for a resource. Replaces any existing policy. | |
lock | exec | projectsId , locationsId , documentsId | Lock the document so the document cannot be updated by other users. | |
linked_targets | exec | projectsId , locationsId , documentsId | Return all target document-links from the document. | |
search | exec | projectsId , locationsId | Searches for documents using provided SearchDocumentsRequest. This call only returns documents that the caller has permission to search against. | |
linked_sources | exec | projectsId , locationsId , documentsId | Return all source document-links from the document. |
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 |
---|---|---|
documentsId | string | |
locationsId | string | |
projectsId | string |
SELECT
examples
- get
Gets a document. Returns NOT_FOUND if the document does not exist.
SELECT
name,
cloudAiDocument,
contentCategory,
createTime,
creator,
displayName,
displayUri,
dispositionTime,
documentSchemaName,
inlineRawDocument,
legalHold,
plainText,
properties,
rawDocumentFileType,
rawDocumentPath,
referenceId,
textExtractionDisabled,
textExtractionEnabled,
title,
updateTime,
updater
FROM google.contentwarehouse.documents
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND documentsId = '{{ documentsId }}' -- required;
INSERT
examples
- create
- Manifest
Creates a document.
INSERT INTO google.contentwarehouse.documents (
data__cloudAiDocumentOption,
data__createMask,
data__policy,
data__requestMetadata,
data__document,
projectsId,
locationsId
)
SELECT
'{{ cloudAiDocumentOption }}',
'{{ createMask }}',
'{{ policy }}',
'{{ requestMetadata }}',
'{{ document }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
document,
longRunningOperations,
metadata,
ruleEngineOutput
;
# Description fields are for documentation purposes
- name: documents
props:
- name: projectsId
value: string
description: Required parameter for the documents resource.
- name: locationsId
value: string
description: Required parameter for the documents resource.
- name: cloudAiDocumentOption
value: object
description: >
Request Option for processing Cloud AI Document in Document Warehouse. This field offers limited support for mapping entities from Cloud AI Document to Warehouse Document. Please consult with product team before using this field and other available options.
- name: createMask
value: string
description: >
Field mask for creating Document fields. If mask path is empty, it means all fields are masked. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.
- name: policy
value: object
description: >
Default document policy during creation. This refers to an Identity and Access (IAM) policy, which specifies access controls for the Document. Conditions defined in the policy will be ignored.
- name: requestMetadata
value: object
description: >
The meta information collected about the end user, used to enforce access control for the service.
- name: document
value: object
description: >
Required. The document to create.
UPDATE
examples
- patch
Updates a document. Returns INVALID_ARGUMENT if the name of the document is non-empty and does not equal the existing name.
UPDATE google.contentwarehouse.documents
SET
data__updateOptions = '{{ updateOptions }}',
data__document = '{{ document }}',
data__requestMetadata = '{{ requestMetadata }}',
data__cloudAiDocumentOption = '{{ cloudAiDocumentOption }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND documentsId = '{{ documentsId }}' --required
RETURNING
document,
metadata,
ruleEngineOutput;
DELETE
examples
- delete
Deletes a document. Returns NOT_FOUND if the document does not exist.
DELETE FROM google.contentwarehouse.documents
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND documentsId = '{{ documentsId }}' --required;
Lifecycle Methods
- set_acl
- lock
- linked_targets
- search
- linked_sources
Sets the access control policy for a resource. Replaces any existing policy.
EXEC google.contentwarehouse.documents.set_acl
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@documentsId='{{ documentsId }}' --required
@@json=
'{
"requestMetadata": "{{ requestMetadata }}",
"policy": "{{ policy }}",
"projectOwner": {{ projectOwner }}
}';
Lock the document so the document cannot be updated by other users.
EXEC google.contentwarehouse.documents.lock
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@documentsId='{{ documentsId }}' --required
@@json=
'{
"collectionId": "{{ collectionId }}",
"lockingUser": "{{ lockingUser }}"
}';
Return all target document-links from the document.
EXEC google.contentwarehouse.documents.linked_targets
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@documentsId='{{ documentsId }}' --required
@@json=
'{
"requestMetadata": "{{ requestMetadata }}"
}';
Searches for documents using provided SearchDocumentsRequest. This call only returns documents that the caller has permission to search against.
EXEC google.contentwarehouse.documents.search
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required
@@json=
'{
"offset": {{ offset }},
"requestMetadata": "{{ requestMetadata }}",
"documentQuery": "{{ documentQuery }}",
"totalResultSize": "{{ totalResultSize }}",
"pageToken": "{{ pageToken }}",
"requireTotalSize": {{ requireTotalSize }},
"orderBy": "{{ orderBy }}",
"pageSize": {{ pageSize }},
"histogramQueries": "{{ histogramQueries }}",
"qaSizeLimit": {{ qaSizeLimit }}
}';
Return all source document-links from the document.
EXEC google.contentwarehouse.documents.linked_sources
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@documentsId='{{ documentsId }}' --required
@@json=
'{
"pageSize": {{ pageSize }},
"requestMetadata": "{{ requestMetadata }}",
"pageToken": "{{ pageToken }}"
}';