public class DocumentRequest extends VaultRequest
Many documents requests, including single document requests, leverage the Document
model
for inbound/outbound API calls. This includes setters/getters for standard Vault fields and
a setter/getter for custom fields. Example:
Document doc = new Document(); doc.setName("VAPIL Single Document"); doc.setLifecycle("General Lifecycle"); doc.setType("General"); doc.setTitle("Test Upload VAPIL"); doc.setProperty("custom_field__c", "value"); DocumentResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .createSingleDocument(doc);
Bulk endpoints should be used for multiple document transactions. Example with input CSV file:
DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(csvFilePath) .createMultipleDocuments();
The following endpoints are covered in other classes for ease of use
DocumentAnnotationRequest
DocumentAttachmentRequest
DocumentEventRequest
DocumentRelationshipRequest
DocumentRoleRequest
DocumentRenditionRequest
DocumentTemplateRequest
Modifier and Type | Class and Description |
---|---|
static class |
DocumentRequest.CreateDraftType
Create document from latestcontent or uploadedcontent
|
static class |
DocumentRequest.CrosslinkBinding
Crosslink binding rules enum for doc field picklist source_binding_rule__v
|
static class |
DocumentRequest.DownloadOption
Download option for Document Token
|
static class |
DocumentRequest.NamedFilter
Retrieve all document named filter
|
static class |
DocumentRequest.Scope
Retrieve all document scope
|
static class |
DocumentRequest.VersionsScope
Retrieve all document versions scope
|
Modifier and Type | Field and Description |
---|---|
static String |
HTTP_HEADER_VAULT_MIGRATION_MODE
X-VaultAPI-MigrationMode When set to true, Vault applies Document Migration Mode limitations only to documents created with the request.
|
static String |
ID_PARAM
If you’re identifying documents in your input by a unique field, add idParam={fieldname} to the request endpoint.
|
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_VAULT_CLIENT_ID, vaultClient
Modifier and Type | Method and Description |
---|---|
DocumentResponse |
createContentPlaceholderDocument(Document doc)
Create Content Placeholder Documents
|
DocumentResponse |
createCrossLinkDocument(Document doc,
int source_vault_id__v,
int source_document_id__v)
Create Crosslink Document
|
DocumentResponse |
createDocumentFromTemplate(Document doc,
String fromTemplate)
Create Documents from Templates
|
VaultResponse |
createDocumentLock(int docId)
Create Document Lock
|
DocumentBulkResponse |
createMultipleDocuments()
Create Multiple Documents
|
DocumentBulkResponse |
createMultipleDocumentVersions()
Create Multiple Document Versions
|
DocumentResponse |
createSingleDocument(Document doc)
Create Single Document
|
DocumentResponse |
createSingleDocumentVersion(int docId,
DocumentRequest.CreateDraftType createDraftType)
Create Single Document Version
|
DocumentResponse |
createUnclassifiedDocument()
Create Unclassified Documents
|
VaultResponse |
deleteDocumentLock(int docId)
Deleting Document Lock
|
DocumentBulkResponse |
deleteMultipleDocuments()
Delete Multiple Documents
|
DocumentBulkResponse |
deleteMultipleDocumentVersions()
Delete Multiple Document Versions
|
DocumentResponse |
deleteSingleDocument(int docid)
Delete Single Document
|
DocumentResponse |
deleteSingleDocumentVersion(int docId,
int majorVersion,
int minorVersion)
Delete Single Document Version
|
DocumentTokenResponse |
documentTokens(List<Integer> docIds)
Document Tokens
|
VaultResponse |
downloadDocumentFile(int docId)
Download Document File
|
VaultResponse |
downloadDocumentVersionFile(int docId,
int majorVersion,
int minorVersion)
Download Document Version File
|
VaultResponse |
downloadDocumentVersionThumbnailFile(int docId,
int majorVersion,
int minorVersion)
Download Document Version Thumbnail File
|
JobCreateResponse |
exportDocuments(boolean includeSource,
boolean includeRenditions,
boolean includeAllVersions)
Export Documents
|
JobCreateResponse |
exportDocumentVersions(boolean includeSource,
boolean includeRenditions)
Export Document Versions
|
DocumentResponse |
reclassifyDocument(Document doc)
Reclassify Document
|
DocumentFieldResponse |
retrieveAllDocumentFields()
Retrieve All Document Fields
|
DocumentsResponse |
retrieveAllDocuments()
Retrieve All Documents
|
DocumentTypesResponse |
retrieveAllDocumentTypes()
Retrieve All Document Types
|
DocumentFieldResponse |
retrieveCommonDocumentFields(Set<Integer> docIds)
Retrieve Common Document Fields
|
DocumentDeletionResponse |
retrieveDeletedDocumentIds()
Retrieve Deleted Document IDs
|
DocumentResponse |
retrieveDocument(int docId)
Retrieve Document
|
DocumentClassificationResponse |
retrieveDocumentClassification(String type,
String subType,
String classification)
Retrieve Document Classification
|
DocumentExportResponse |
retrieveDocumentExportResults(int jobId)
Retrieve Document Export Results
|
DocumentLockResponse |
retrieveDocumentLock(int docId)
Retrieve Document Lock
|
MetaDataDocumentLockResponse |
retrieveDocumentLockMetadata()
Retrieve Document Lock Metadata
|
DocumentSubtypeResponse |
retrieveDocumentSubtype(String type,
String subType)
Retrieve Document Subtype
|
DocumentTypeResponse |
retrieveDocumentType(String type)
Retrieve Document Type
|
DocumentResponse |
retrieveDocumentVersion(int docId,
int majorVersion,
int minorVersion)
Retrieve Document Version
|
DocumentVersionResponse |
retrieveDocumentVersions(int docId)
Retrieve Document Versions
|
DocumentRequest |
setBinaryFile(String filename,
byte[] binaryContent)
Specify source data in an input file
|
DocumentRequest |
setBoundSourceMajorVersion(Integer boundSourceMajorVersion)
Specify the Cross-Link Bound Source Major Version
|
DocumentRequest |
setBoundSourceMinorVersion(Integer boundSourceMinorVersion)
Specify the Cross-Link Bound Source Minor Version
|
DocumentRequest |
setChannel(String channel)
Include the channel request parameter set to the website object record id value
that corresponds to the distribution channel where the document is being made available.
|
DocumentRequest |
setContentTypeCsv()
Set the Header Content Type to CSV
|
DocumentRequest |
setContentTypeJson()
Set the Header Content Type to JSON
|
DocumentRequest |
setDescription(String description)
Specify description
|
DocumentRequest |
setDownloadOption(DocumentRequest.DownloadOption downloadOption)
Include the downloadOption request parameter set to PDF, source, both, or none.
|
DocumentRequest |
setEndData(String endDate)
Set the end date, used to set end date Retrieve Deleted Document IDs API
|
DocumentRequest |
setExpiryDateOffset(Integer expiryDateOffset)
Specify number of days after which the tokens will expire
and the documents will no longer be available in the viewer.
|
DocumentRequest |
setIdParam(String idParam)
Specify an UPSERT operation via the idParam
|
DocumentRequest |
setInputPath(String inputPath)
Specify source data in an input file
|
DocumentRequest |
setLimit(Integer limit)
Set the limit of documents returned by retrieve all documents
|
DocumentRequest |
setLockDocument(Boolean lockDocument)
Specify to check out the document before retrieval
|
DocumentRequest |
setMigrationMode(boolean migrationMode)
Enable migration mode to create multiple document versions in bulk
and perform manual assignment of documents numbers.
|
DocumentRequest |
setOffset(Integer offset)
Set the offset, used to paginate Retrieve Deleted Document IDs API
|
DocumentRequest |
setOutputPath(String outputPath)
Specify source data in an output file
|
DocumentRequest |
setRequestString(String requestString)
Specify source data in an input string, such as a JSON request
|
DocumentRequest |
setScopeFilter(DocumentRequest.NamedFilter namedFilter)
Set named filter of documents returned by retrieve all documents
|
DocumentRequest |
setScopeFilter(DocumentRequest.Scope scope)
Set scope of documents returned by retrieve all documents
|
DocumentRequest |
setSearchKeyword(String keyword)
Search keyword for documents returned by retrieve all documents
|
DocumentRequest |
setSort(String sort)
Sort for documents returned by retrieve all documents
|
DocumentRequest |
setSourceBindingRule(DocumentRequest.CrosslinkBinding sourceBindingRule)
Specify the Cross-Link Source Binding Rule
|
DocumentRequest |
setStart(Integer start)
Set the starting position of documents returned by retrieve all documents
|
DocumentRequest |
setStartData(String startDate)
Set the start date, used to set start date for Retrieve Deleted Document IDs API
|
DocumentRequest |
setSteadyState(Boolean steadyState)
Document Tokens:
If set to true, Vault generates a token for the latest steady state version of a document.
|
DocumentRequest |
setSuppressRendition(Boolean suppressRendition)
Specify whether to suppress rendition
|
DocumentRequest |
setTokenGroup(String tokenGroup)
This only required if you want to group together generated tokens for multiple documents
in order to display the documents being referenced in the same viewer.
|
DocumentRequest |
setVersionScope(DocumentRequest.VersionsScope versionsScope)
Set all versions or latest version of documents returned by retrieve all documents
|
DocumentResponse |
updateDocumentVersion(Document doc,
int majorVersion,
int minorVersion)
Update Document Version
|
DocumentBulkResponse |
updateMultipleDocuments()
Update Multiple Documents
|
DocumentResponse |
updateSingleDocument(Document doc)
Update Single Document
|
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setVaultClient
public static final String HTTP_HEADER_VAULT_MIGRATION_MODE
public static final String ID_PARAM
public DocumentFieldResponse retrieveAllDocumentFields()
Retrieve all standard and custom document fields and field properties.
GET /api/{version}/metadata/objects/documents/properties
DocumentFieldResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveAllDocumentFields();
System.out.println(resp.getResponse());
public DocumentFieldResponse retrieveCommonDocumentFields(Set<Integer> docIds)
Retrieve all document fields and field properties which are common to (shared by) a specified set of documents. This allows you to determine which document fields are eligible for bulk update.
docIds
- List of Document IdsPOST /api/{version}/metadata/objects/documents/properties/find_common
DocumentFieldResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveCommonDocumentFields();
System.out.println(resp.getResponse());
public DocumentTypesResponse retrieveAllDocumentTypes()
Retrieve all document types. These are the top-level of the document type/subtype/classification hierarchy.
GET /api/{version}/metadata/objects/documents/types
DocumentTypesResponse allTypesResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveAllDocumentTypes();
System.out.println(allTypesResponse.getResponse()); for (DocumentTypesResponse.DocumentType documentType : allTypesResponse.getTypes()) { DocumentTypeResponse typeResponse = vaultClient.newRequest(DocumentRequest.class).retrieveDocumentType(documentType.getName()); System.out.println(typeResponse.getResponse()); if (typeResponse.getSubtypes() != null) { for (DocumentTypeResponse.DocumentSubtype documentSubtype : typeResponse.getSubtypes()) { DocumentSubtypeResponse subtypeResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentSubtype(documentType.getName(), documentSubtype.getName()); System.out.println(subtypeResponse.getResponse()); if (subtypeResponse.getClassifications() != null) { for (DocumentSubtypeResponse.DocumentClassification documentClassification : subtypeResponse.getClassifications()) { DocumentClassificationResponse classificationResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentClassification( documentType.getName(), documentSubtype.getName(), documentClassification.getName()); System.out.println(classificationResponse.getResponse()); } } } } } }
public DocumentTypeResponse retrieveDocumentType(String type)
Retrieve all metadata from a document type, including all of its subtypes (when available).
type
- document type (api name)GET /api/{version}/metadata/objects/documents/types/{type}
DocumentTypeResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveCommonDocumentFields();
System.out.println(resp.getResponse());
public DocumentSubtypeResponse retrieveDocumentSubtype(String type, String subType)
Retrieve all metadata from a document subtype, including all of its classifications (when available).
type
- document type (api name)subType
- document subType (api name)GET /api/{version}/metadata/objects/documents/types/{type}/subtypes/{subtype}
DocumentSubtypeResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentSubtype(documentType.getName(), documentSubtype.getName());
System.out.println(resp.getResponse());
public DocumentClassificationResponse retrieveDocumentClassification(String type, String subType, String classification)
type
- document type (api name)subType
- document subType (api name)classification
- document classification (api name)GET /api/{version}/metadata/objects/documents/types/{type}/subtypes/{subtype}/classifications/{classification}
DocumentClassificationResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentClassification(type,subtype,classification);
System.out.println(classificationResponse.getResponse());
public DocumentsResponse retrieveAllDocuments()
Retrieve the latest version of all documents and binders
Various properties can filter the list of returned documents
GET /api/{version}/objects/documents
DocumentsResponse resp = vaultClient.newRequest(DocumentRequest.class) .retrieveAllDocuments();
System.out.println(resp.getResponse());
public DocumentResponse retrieveDocument(int docId)
Retrieve all metadata from a single document
docId
- The Document IdGET /api/{version}/objects/documents/{doc_id}
DocumentResponse resp = vaultClient.newRequest(DocumentRequest.class).retrieveDocument(docId);
System.out.println(resp.getResponse()); Document responseDoc = resp.getDocument(); System.out.println("Name = " + responseDoc.getName()); System.out.println("Title = " + responseDoc.getTitle()); // Get a custom property System.out.println("Custom property custom__c = " + responseDoc.get("custom__c")); System.out.println("Renditions " + documentResponse.getRenditions().getViewableRendition()); for (DocumentResponse.Version v : documentResponse.getVersions()) System.out.println("Version = " + v.getNumber() + " " + v.getValue()); for (DocumentResponse.Version v : resp.getVersions()) System.out.println("Version = " + v.getNumber() + " " + v.getValue());
public DocumentVersionResponse retrieveDocumentVersions(int docId)
Retrieve all versions of a document.
docId
- The Document IdGET /api/{version}/objects/documents/{doc_id}/versions
DocumentResponse resp = vaultClient.newRequest(DocumentRequest.class).retrieveDocumentVersion(docId, 0, 1);
See retrieveDocument(int)
for example responses
public DocumentResponse retrieveDocumentVersion(int docId, int majorVersion, int minorVersion)
Retrieve all fields and values configured on a document version.
docId
- The Document IdmajorVersion
- document major version numberminorVersion
- document minor version numberGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}
DocumentResponse versionResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentVersion(docId, 0, 1);
See retrieveDocument(int)
for example responses
public VaultResponse downloadDocumentFile(int docId)
docId
- The Document IdGET /api/{version}/objects/documents/{doc_id}/file
VaultResponse response = vaultClient.newRequest(DocumentRequest.class).downloadDocumentFile(docId);
if (response != null && response.isSuccessful()) { System.out.println("Doc content length: " + response.getBinaryContent().length);}
public VaultResponse downloadDocumentVersionFile(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- document major version numberminorVersion
- document minor version numberGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/file
VaultResponse response = vaultClient.newRequest(DocumentRequest.class) .downloadDocumentVersionFile(docId, majorVersion, minorVersion);
if (response != null && response.isSuccessful()) { System.out.println("Created doc content length: " + response.getBinaryContent().length); }
public VaultResponse downloadDocumentVersionThumbnailFile(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- document major version numberminorVersion
- document minor version numberGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/thumbnail
VaultResponse response = vaultClient.newRequest(DocumentRequest.class) .downloadDocumentVersionThumbnailFile(docId, majorVersion, minorVersion);
if (response != null && response.isSuccessful()) { System.out.println("Created doc content length: " + response.getBinaryContent().length); }
public DocumentResponse createSingleDocument(Document doc)
Create a single document by uploading the specified file.
Use either the local path or binaryfile setters.
Use bulk for multiple documents! See createMultipleDocuments()
.
doc
- Document metadata to createPOST /api/{version}/objects/documents
Document doc = new Document(); doc.setName("VAPIL Single Document"); doc.setLifecycle("General Lifecycle"); doc.setType("General"); doc.setTitle("Test Upload VAPIL"); DocumentResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .createSingleDocument(doc);
System.out.println("Created doc id: " + response.getDocument().getId());
public DocumentResponse createDocumentFromTemplate(Document doc, String fromTemplate)
doc
- Document to createfromTemplate
- The Template to create fromPOST /api/{version}/objects/documents
DocumentResponse response = vaultClient.newRequest(DocumentRequest.class).createDocumentFromTemplate(doc, "template_name__c");
System.out.println("Created doc id: " + response);
public DocumentResponse createContentPlaceholderDocument(Document doc)
doc
- Document to createPOST /api/{version}/objects/documents
DocumentResponse response = vaultClient.newRequest(DocumentRequest.class).createContentPlaceholderDocument(doc);
System.out.println("Created doc id: " + response.getDocument().getId());
public DocumentResponse createUnclassifiedDocument()
POST /api/{version}/objects/documents
DocumentResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .createUnclassifiedDocument();
System.out.println("Created doc id: " + response.getDocument().getId());
public DocumentResponse createCrossLinkDocument(Document doc, int source_vault_id__v, int source_document_id__v)
When creating a CrossLink document, you must include all document fields that are required for the specified document type/subtype/classification and no file is uploaded. You must also specify the vault ID and document ID for the source document which will be bound to the new CrossLink document.
Source binding rules define which version of the source document will be bound to the CrossLink document. If not specified, this defaults to the Latest Steady State version.
doc
- Document to createsource_vault_id__v
- The source Vault Idsource_document_id__v
- The source document idPOST /api/{version}/objects/documents
Document doc = new Document(); doc.setName("VAPIL CrossLink"); doc.setLifecycle("General Lifecycle"); doc.setType("General"); doc.setTitle("VAPIL CrossLink - latest version"); Example 1 - Create Crosslink response = vaultClient.newRequest(DocumentRequest.class) .setSourceBindingRule(DocumentRequest.CrosslinkBinding.LATEST) .createCrossLinkDocument(doc, vaultId, crosslinkDocId); Example 2 - Create Crosslink Bound to Latest Version DocumentResponse response = vaultClient.newRequest(DocumentRequest.class) .createCrossLinkDocument(doc, vaultId, crosslinkDocId); Example 3 - Create Crosslink Bound to Specific Document Version DocumentResponse response = vaultClient.newRequest(DocumentRequest.class) .setSourceBindingRule(DocumentRequest.CrosslinkBinding.SPECIFIC) .setBoundSourceMajorVersion(1) .setBoundSourceMinorVersion(0) .createCrossLinkDocument(doc, vaultId, crosslinkDocId);
System.out.println("Created doc id: " + response.getDocument().getId());
public DocumentBulkResponse createMultipleDocuments()
This endpoint allows you to create multiple documents at once with a CSV input file.
The maximum CSV input file size is 1GB. The values in the input must be UTF-8 encoded. CSVs must follow the standard format. The maximum batch size is 500.
POST /api/{version}/objects/documents/batch
Example 1 - CSV input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(csvFilePath) .createMultipleDocuments();,
Example 2 - Binary input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setBinaryFile(csv.getName(), Files.readAllBytes(csv.toPath())) .createMultipleDocuments();
System.out.println(response.getResponse());
public DocumentResponse updateSingleDocument(Document doc)
Update editable field values on the latest version of a single document. To update past document versions, see Update Document Version. Note that this endpoint does not allow you to update the archive__v field.
Use bulk for multiple documents! See updateMultipleDocuments()
.
doc
- Document metadata to updatePUT /api/{version}/objects/documents/{doc_id}
public DocumentBulkResponse updateMultipleDocuments()
Bulk update editable field values on multiple documents. You can only update the latest version of each document.
PUT /api/{version}/objects/documents/batch
Example 1 - CSV input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(csvFilePath) .updateMultipleDocuments();,
Example 2 - Binary input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setBinaryFile(csv.getName(), Files.readAllBytes(csv.toPath())) .updateMultipleDocuments();
System.out.println(response.getResponse());
public DocumentResponse reclassifyDocument(Document doc)
Reclassify allows you to change the document type of an existing document or assign a document type to an unclassified document. A document is the combination of the type__v, subtype__v, and classification__v fields on a document. When you reclassify, Vault may add or remove certain fields on the document. You can only reclassify the latest version of a document and only one document at a time. The API does not currently support bulk reclassify.
doc
- Document metadata to reclassifyPUT /api/{version}/objects/documents/{doc_id}
public DocumentResponse updateDocumentVersion(Document doc, int majorVersion, int minorVersion)
Update editable field values on a specific version of a document.
doc
- Document metadata to updatemajorVersion
- document major version numberminorVersion
- document minor version numberPUT /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}
public DocumentBulkResponse createMultipleDocumentVersions()
Your vault must be in Migration Mode. The maximum CSV input file size is 1GB. The values in the input must be UTF-8 encoded. CSVs must follow the standard format. The maximum batch size is 500.
POST /api/{version}/objects/documents/versions/batch
public DocumentResponse createSingleDocumentVersion(int docId, DocumentRequest.CreateDraftType createDraftType)
Add a new draft version of an existing document. You can choose to either use the existing source file, or a new source file. These actions will increase the document’s minor version number. This is analogous to using the Create Draft action in the UI. Use bulk for multiple documents!
docId
- Document idcreateDraftType
- latestContent or uploadedContentPOST /api/{version}/objects/documents/{doc_id}
DocumentResponse response =vaultClient.newRequest(DocumentRequest.class) .createSingleDocumentVersion(docId, DocumentRequest.CreateDraftType.LATESTCONTENT);
if (response != null && response.isSuccessful()) { System.out.println("Created doc id: " + response.getDocument().getId()); }
public DocumentResponse deleteSingleDocument(int docid)
Delete all versions of a document, including all source files and viewable renditions.
docid
- The Document IdDELETE /api/{version}/objects/documents/{document_id}
public DocumentBulkResponse deleteMultipleDocuments()
Delete all versions of multiple documents, including all source files and viewable renditions.
The maximum input file size is 1GB. The values in the input must be UTF-8 encoded. CSVs must follow the standard format. The maximum batch size is 500.
DELETE /api/{version}/objects/documents/batch
Example 1 - CSV input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(csvFilePath) .deleteMultipleDocuments();,
Example 2 - Binary input DocumentBulkResponse response = vaultClient.newRequest(DocumentRequest.class) .setBinaryFile(csv.getName(), Files.readAllBytes(csv.toPath())) .deleteMultipleDocuments();
System.out.println(response.getResponse());
public DocumentResponse deleteSingleDocumentVersion(int docId, int majorVersion, int minorVersion)
Delete a specific version of a document, including the version’s source file and viewable rendition. Other versions of the document remain unchanged.
docId
- Document metadata to updatemajorVersion
- document major version numberminorVersion
- document minor version numberDELETE /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}
public DocumentBulkResponse deleteMultipleDocumentVersions()
Delete a specific version of multiple documents, including the version’s source file and viewable rendition.
The maximum input file size is 1GB. The values in the input must be UTF-8 encoded. CSVs must follow the standard format. The maximum batch size is 500.
DELETE /api/{version}/objects/documents/versions/batch
public DocumentDeletionResponse retrieveDeletedDocumentIds()
Retrieve IDs of documents deleted within the past 30 days.
After documents and document versions are deleted, their IDs remain available for retrieval for 30 days. After that, they cannot be retrieved. This request supports optional parameters to narrow the results to a specific date and time range within the past 30 days.
To completely restore a document deleted within the last 30 days, contact Veeva support.
GET /api/{version}/objects/deletions/documents
DocumentDeletionResponse response = vaultClient.newRequest(DocumentRequest.class).retrieveDeletedDocumentIds();
if (response != null && response.isSuccessful()) { System.out.println("# deleted docs: " + response.getResponseDetails().getTotal()); }
public MetaDataDocumentLockResponse retrieveDocumentLockMetadata()
GET /api/{version}/metadata/objects/documents/lock
MetaDataDocumentLockResponse response = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentLockMetadata();
if (response.isSuccessful()) { for (DocumentLock documentLock : response.getProperties()) { System.out.println("Document Lock Properties: " + documentLock.getName()); } }
public VaultResponse createDocumentLock(int docId)
A document lock is analogous to checking out a document but without the file attached in the response for download.
docId
- document idPOST /api/{version}/objects/documents/{doc_id}/lock
VaultResponse lockCreateResponse = vaultClient.newRequest(DocumentRequest.class) .createDocumentLock(docId);
System.out.println("Document Lock Created: " + lockCreateResponse.getResponseStatus());
public DocumentLockResponse retrieveDocumentLock(int docId)
docId
- document idGET /api/{version}/objects/documents/{doc_id}/lock
DocumentLockResponse lockResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentLock(docId);
System.out.println("Document Lock By: " + lockResponse.getLock().getLockedBy()); System.out.println("Document Lock Date: " + lockResponse.getLock().getLockedDate());
public VaultResponse deleteDocumentLock(int docId)
Deleting a document lock is analogous to undoing check out of a document.
docId
- document idDELETE /api/{version}/objects/documents/{doc_id}/lock
VaultResponse lockDeleteResponse = vaultClient.newRequest(DocumentRequest.class) .deleteDocumentLock(docId);
System.out.println("Document Lock Deleted: " + lockDeleteResponse.getResponseStatus());
public JobCreateResponse exportDocuments(boolean includeSource, boolean includeRenditions, boolean includeAllVersions)
Use this request to export a set of document to your vault’s FTP staging server.
includeSource
- indicates to include source content filesincludeRenditions
- indicates to include renditionsincludeAllVersions
- indicates to include all versionsPOST /api/{version}/objects/documents/batch/actions/fileextract
JobCreateResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .exportDocuments(true, true, true);
if (response != null && response.isSuccessful()) { System.out.println("Job Id: " + response.getJobId()); }
public JobCreateResponse exportDocumentVersions(boolean includeSource, boolean includeRenditions)
Export a specific set of document versions to your vault’s FTP staging server. The files you export go to the u{userID} folder, regardless of your security profile.
includeSource
- indicates to include source content filesincludeRenditions
- indicates to include renditionsPOST /api/{version}/objects/documents/versions/batch/actions/fileextract
JobCreateResponse response = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .exportDocumentVersions(true, true);
if (response != null && response.isSuccessful()) { System.out.println("Job Id: " + response.getJobId()); }
public DocumentExportResponse retrieveDocumentExportResults(int jobId)
After submitting a request to export documents from your vault, you can query your vault to determine the results of the request.
Before submitting this request:
You must have previously requested a document export job (via the API) which is no longer active.
You must have a valid job_id value (retrieved from the document export binder request above).
You must be a Vault Owner, System Admin or the user who initiated the job.
jobId
- job idGET /api/{version}/objects/documents/batch/actions/fileextract/{jobid}/results
DocumentExportResponse exportResponse = vaultClient.newRequest(DocumentRequest.class) .retrieveDocumentExportResults(jobId);
if (exportResponse != null && exportResponse.isSuccessful()) { List<DocumentExportResponse.ExportedDocument> exportedDocumentList = exportResponse.getData(); if (exportedDocumentList != null) { for (DocumentExportResponse.ExportedDocument exportedDocument : exportedDocumentList) { System.out.println("id: " + exportedDocument.getId()); System.out.println("major version: " + exportedDocument.getMajorVersionNumber()); System.out.println("minor version: " + exportedDocument.getMinorVersionNumber()); System.out.println("File: " + exportedDocument.getFile()); } } }
public DocumentTokenResponse documentTokens(List<Integer> docIds)
The Vault Document Tokens API allows you to generates document access tokens needed by the external viewer to view documents outside of Vault.
docIds
- list of document idsPOST /api/{version}/objects/documents/tokens
DocumentTokenResponse response = vaultClient.newRequest(DocumentRequest.class) .setExpiryDateOffset(10) .setDownloadOption(DocumentRequest.DownloadOption.PDF) .setTokenGroup("example") .documentTokens(docIds);
System.out.println(response.getResponse());
public DocumentRequest setBinaryFile(String filename, byte[] binaryContent)
filename
- file name (no path)binaryContent
- byte array of the file contentpublic DocumentRequest setBoundSourceMajorVersion(Integer boundSourceMajorVersion)
boundSourceMajorVersion
- Required when the source_binding_rule__v is set to Specific Document versionpublic DocumentRequest setBoundSourceMinorVersion(Integer boundSourceMinorVersion)
boundSourceMinorVersion
- Required when the source_binding_rule__v is set to Specific Document versionpublic DocumentRequest setChannel(String channel)
channel
- channelpublic DocumentRequest setContentTypeCsv()
public DocumentRequest setContentTypeJson()
public DocumentRequest setDescription(String description)
description
- description__vpublic DocumentRequest setDownloadOption(DocumentRequest.DownloadOption downloadOption)
downloadOption
- downloadOption for document tokenspublic DocumentRequest setExpiryDateOffset(Integer expiryDateOffset)
expiryDateOffset
- description__vpublic DocumentRequest setIdParam(String idParam)
idParam
- External Id field API name for the UPSERTpublic DocumentRequest setLimit(Integer limit)
limit
- max number of documents returnedpublic DocumentRequest setInputPath(String inputPath)
inputPath
- Absolute path to the file for the requestpublic DocumentRequest setLockDocument(Boolean lockDocument)
lockDocument
- whether or not to lock the documentpublic DocumentRequest setOutputPath(String outputPath)
outputPath
- Absolute path to the file for the responsepublic DocumentRequest setScopeFilter(DocumentRequest.NamedFilter namedFilter)
namedFilter
- named filter for documentspublic DocumentRequest setRequestString(String requestString)
requestString
- The source request as a stringpublic DocumentRequest setScopeFilter(DocumentRequest.Scope scope)
scope
- scope of documentspublic DocumentRequest setSearchKeyword(String keyword)
keyword
- keyword to search forpublic DocumentRequest setSort(String sort)
sort
- order by valuepublic DocumentRequest setSourceBindingRule(DocumentRequest.CrosslinkBinding sourceBindingRule)
sourceBindingRule
- Possible values are Latest version, Latest Steady State version, or Specific Document versionpublic DocumentRequest setStart(Integer start)
start
- starting positionpublic DocumentRequest setSteadyState(Boolean steadyState)
steadyState
- true/falsepublic DocumentRequest setSuppressRendition(Boolean suppressRendition)
suppressRendition
- Required when the source_binding_rule__v is set to Specific Document versionpublic DocumentRequest setTokenGroup(String tokenGroup)
tokenGroup
- name of grouppublic DocumentRequest setVersionScope(DocumentRequest.VersionsScope versionsScope)
versionsScope
- scope for versionspublic DocumentRequest setMigrationMode(boolean migrationMode)
migrationMode
- The source request as a stringpublic DocumentRequest setOffset(Integer offset)
offset
- The offset as an intpublic DocumentRequest setStartData(String startDate)
startDate
- The start date as a string in the YYYY-MM-DDTHH:MM:SSZ formatpublic DocumentRequest setEndData(String endDate)
endDate
- The end date as a string in the YYYY-MM-DDTHH:MM:SSZ formatCopyright © 2021. All rights reserved.