public class DocumentAnnotationRequest extends VaultRequest<DocumentAnnotationRequest>
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_REFERENCE_ID, HTTP_HEADER_VAULT_CLIENT_ID, referenceId, vaultClient
Modifier and Type | Method and Description |
---|---|
DocumentAnnotationDeleteResponse |
deleteAnnotations()
Delete Annotations
|
VaultResponse |
exportDocumentAnnotationsToPdf(int docId)
Export Document Annotations to PDF
|
VaultResponse |
exportDocumentVersionAnnotationsToPdf(int docId,
int majorVersion,
int minorVersion)
Export Document Version Annotations to PDF
|
DocumentAnnotationResponse |
importDocumentAnnotationsFromPdf(int docId)
Import Document Annotations from PDF
|
DocumentAnnotationResponse |
importDocumentVersionAnnotationsFromPdf(int docId,
int majorVersion,
int minorVersion)
Import Document Version Annotations from PDF
Load annotations from a PDF to Vault. |
DocumentAnnotationReadResponse |
readAnnotationsByDocumentVersionAndType(int docId,
int majorVersion,
int minorVersion)
Read Annotations by Document Version and Type
Retrieve annotations from a specific document version. |
DocumentAnnotationReadResponse |
readAnnotationsByDocumentVersionAndTypeByPage(String pageUrl)
Read Annotations by Document Version and Type (By Page)
|
DocumentAnnotationReadResponse |
readAnnotationsById(int docId,
int majorVersion,
int minorVersion,
int annotationId)
Read Annotations by ID
|
DocumentAnnotationReplyReadResponse |
readRepliesOfParentAnnotation(int docId,
int majorVersion,
int minorVersion,
int annotationId)
Read Replies of Parent Annotation
Given a parent annotation ID, retrieves all replies to the annotation. |
DocumentAnnotationReplyReadResponse |
readRepliesOfParentAnnotationByPage(String pageUrl)
Read Replies of Parent Annotation (By Page)
|
DocumentAnnotationResponse |
retrieveAnchorIds(int docId)
Retrieve Anchor IDs
|
VaultResponse |
retrieveDocumentVersionNotesAsCSV(int docId,
int majorVersion,
int minorVersion)
Retrieve Document Version Notes as CSV
Retrieve notes in CSV format for any document that has a viewable rendition and at least one annotation. |
VaultResponse |
retrieveVideoAnnotations(int docId,
int majorVersion,
int minorVersion)
Retrieve Video Annotations
Retrieve annotations on a video document. |
DocumentAnnotationRequest |
setAnnotationTypes(Set<String> annotationTypes)
The type(s) of annotations to retrieve.
|
DocumentAnnotationRequest |
setBinaryFile(String filename,
byte[] binaryContent)
Specify source data in an input file
|
DocumentAnnotationRequest |
setContentTypeCsv()
Set the Header Content Type to CSV
|
DocumentAnnotationRequest |
setContentTypeJson()
Set the Header Content Type to JSON
|
DocumentAnnotationRequest |
setInputPath(String inputPath)
Specify source data in an input file
|
DocumentAnnotationRequest |
setLimit(Integer limit)
This parameter paginates the results by specifying the maximum number of records per page in the response.
|
DocumentAnnotationRequest |
setOffset(Integer offset)
This parameter is used to paginate the results.
|
DocumentAnnotationRequest |
setOutputPath(String outputPath)
Specify source data in an output file
|
DocumentAnnotationRequest |
setPaginationId(String paginationId)
A unique identifier used to load requests with paginated results.
|
DocumentAnnotationRequest |
setRequestString(String requestString)
Specify source data in an input string, such as a JSON request
|
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setHeaderReferenceId, setVaultClient
public VaultResponse exportDocumentAnnotationsToPdf(int docId)
Export the latest version of any document, along with its annotations, as an annotated PDF. This is equivalent to the Export Annotations action in the Vault document viewer UI.
docId
- The document id field value.GET /api/{version}/objects/documents/{doc_id}/annotations/file
Example 1 - Bytes VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .exportDocumentAnnotationsToPdf(docId); Example 2 - File VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setOutputPath(outputPath) .exportDocumentAnnotationsToPdf(docId);
Example 1 - Bytes byte[] bytes = response.getBinaryContent(); Example 2 - File System.out.println("Output file: " + response.getOutputFilePath());
public VaultResponse exportDocumentVersionAnnotationsToPdf(int docId, int majorVersion, int minorVersion)
Export a specific version of any document, along with its annotations, as an annotated PDF. This is equivalent to the Export Annotations action in the Vault document viewer UI.
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valueGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations/file
Example 1 - Bytes VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .exportDocumentVersionAnnotationsToPdf(docId, majorVersionNumber, minorVersionNumber); Example 2 - File VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setOutputPath(outputPath) .exportDocumentVersionAnnotationsToPdf(docId, majorVersionNumber, minorVersionNumber);
Example 1 - Bytes byte[] bytes = response.getBinaryContent(); Example 2 - File System.out.println("Output file: " + response.getOutputFilePath());
public DocumentAnnotationResponse retrieveAnchorIds(int docId)
Retrieve all anchor IDs from a document.
docId
- The document id field value.GET /api/{version}/objects/documents/{doc_id}/anchors
DocumentAnnotationResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .retrieveAnchorIds(docId);
System.out.println(response.getResponse()); if (response.isSuccessful()) { for (DocumentAnnotationResponse.AnchorData data : response.wgetAnchorDataList()) { System.out.println("\n**** Data Item **** "); System.out.println("anchorId = " + data.getAnchorId()); System.out.println("noteId = " + data.getNoteId()); System.out.println("anchorName = " + data.getAnchorName()); System.out.println("noteAuthor = " + data.getNoteAuthor()); System.out.println("noteTimestamp = " + data.getNoteTimestamp()); System.out.println("pageNumber = " + data.getPageNumber()); } }
public VaultResponse retrieveDocumentVersionNotesAsCSV(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valueGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/doc-export-annotations-to-csv
Example 1 - To File VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setOutputPath(outputPath.toString()) .retrieveDocumentVersionNotesAsCSV(docId, majorVersion, minorVersion);,
Example 2 - Get the file and manually download (retrieve the file as bytes in the response) VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setOutputPath(null) .retrieveDocumentVersionNotesAsCSV(docId, majorVersion, minorVersion);
if (response.getResponseStatus().equals(VaultResponse.HTTP_RESPONSE_SUCCESS)) { try (OutputStream os = new FileOutputStream(outputPath.toString())) { os.write(response.getBinaryContent()); } catch (IOException ignored) {} } System.out.println("File was saved to: " + response.getOutputFilePath());
public VaultResponse retrieveVideoAnnotations(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valueGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/export-video-annotations
VaultResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setOutputPath(outputPath.toString()) .retrieveVideoAnnotations(docId, majorVersion, minorVersion);
public DocumentAnnotationResponse importDocumentAnnotationsFromPdf(int docId)
Load annotations from a PDF to Vault. This is equivalent to the Import Annotations action in the Vault document viewer UI.
docId
- The document id field value.POST /api/{version}/objects/documents/{doc_id}/annotations/file
DocumentAnnotationResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setInputPath(PATH_ANNOTATIONS_FILE) .importDocumentAnnotationsFromPdf(docId);
System.out.println("New Annotations: " + response.getNewCount()); System.out.println("Replies: " + response.getReplies()); System.out.println("Failures: " + response.getFailures());
public DocumentAnnotationResponse importDocumentVersionAnnotationsFromPdf(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valuePOST /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations/file
DocumentAnnotationResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setInputPath(PATH_ANNOTATIONS_FILE) .importDocumentVersionAnnotationsFromPdf(docId, majorVersionNumber, minorVersionNumber);
System.out.println("New Annotations: " + response.getNewCount()); System.out.println("Replies: " + response.getReplies()); System.out.println("Failures: " + response.getFailures());
public DocumentAnnotationReadResponse readAnnotationsByDocumentVersionAndType(int docId, int majorVersion, int minorVersion)
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valuePOST GET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations
DocumentAnnotationReadResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .readAnnotationsByDocumentVersionAndType(docId, majorVersionNumber, minorVersionNumber);
List<DocumentAnnotation> annotations = response.getData(); for (DocumentAnnotation annotation : annotations) { System.out.println("Annotation ID: " + annotation.getId()); System.out.println("Comment: " + annotation.getComment()); System.out.println("Type: " + annotation.getType()); }
public DocumentAnnotationReadResponse readAnnotationsByDocumentVersionAndTypeByPage(String pageUrl)
Retrieve annotations from a specific document version using the previous_page or next_page parameter of a previous request
pageUrl
- The URL from the previous_page or next_page parameterGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations
if (response.isPaginated()) { String nextPageUrl = response.getResponseDetails().getNextPage(); DocumentAnnotationReadResponse response_page_2 = vaultClient.newRequest(DocumentAnnotationRequest.class) .readAnnotationsByDocumentVersionAndTypeByPage(nextPageUrl);
List<DocumentAnnotation> annotations = response_page_2.getData(); for (DocumentAnnotation annotation : annotations) { System.out.println("Annotation ID: " + annotation.getId()); System.out.println("Comment: " + annotation.getComment()); System.out.println("Type: " + annotation.getType()); }
public DocumentAnnotationReadResponse readAnnotationsById(int docId, int majorVersion, int minorVersion, int annotationId)
Retrieve a specific annotation by the annotation ID.
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valueannotationId
- The annotation idGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations/{annotation_id}
DocumentAnnotationReadResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .readAnnotationsById(docId, majorVersionNumber, minorVersionNumber, annotationId);
List<DocumentAnnotation> annotations = response.getData(); for (DocumentAnnotation annotation : annotations) { System.out.println("Annotation ID: " + annotation.getId()); System.out.println("Comment: " + annotation.getComment()); System.out.println("Type: " + annotation.getType()); }
public DocumentAnnotationReplyReadResponse readRepliesOfParentAnnotation(int docId, int majorVersion, int minorVersion, int annotationId)
docId
- The Document IdmajorVersion
- The document major_version_number__v field valueminorVersion
- The document minor_version_number__v field valueannotationId
- The annotation idGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations/{annotation_id}/replies
DocumentAnnotationReplyReadResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .readRepliesOfParentAnnotation(docId, majorVersionNumber, minorVersionNumber, annotationId);
List<DocumentAnnotationReply> replies = response.getData(); for (DocumentAnnotationReply reply : replies) { System.out.println("ID: " + reply.getId()); System.out.println("Comment: " + reply.getComment()); System.out.println("Type: " + reply.getType()); }
public DocumentAnnotationReplyReadResponse readRepliesOfParentAnnotationByPage(String pageUrl)
Retrieve replies from a specific annotation using the previous_page or next_page parameter of a previous request
pageUrl
- The URL from the previous_page or next_page parameterGET /api/{version}/objects/documents/{doc_id}/versions/{major_version}/{minor_version}/annotations/{annotation_id}/replies
if (response.isPaginated()) { String nextPageUrl = response.getResponseDetails().getNextPage(); DocumentAnnotationReplyReadResponse response_page_2 = vaultClient.newRequest(DocumentAnnotationRequest.class) .readRepliesOfParentAnnotationByPage(nextPageUrl);
List<DocumentAnnotationReply> replies = response_page_2.getData(); for (DocumentAnnotationReply reply : replies) { System.out.println("ID: " + reply.getId()); System.out.println("Comment: " + reply.getComment()); System.out.println("Type: " + reply.getType()); }
public DocumentAnnotationDeleteResponse deleteAnnotations()
Delete multiple annotations. You can delete up to 500 annotations per batch.
DELETE/api/{version}/objects/documents/annotations/batch
Example 1 - CSV input DocumentAnnotationDeleteResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setContentTypeCsv() .setInputPath(csvFilePath) .deleteAnnotations(); Example 2 - Binary input DocumentAnnotationDeleteResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setContentTypeCsv() .setBinaryFile(csvFile.getName(), Files.readAllBytes(csvFile.toPath())) .deleteAnnotations(); Example 3 - Json input DocumentAnnotationDeleteResponse response = vaultClient.newRequest(DocumentAnnotationRequest.class) .setContentTypeJson() .setRequestString(requestString) .deleteAnnotations();
List<DeletedAnnotation> deletedAnnotations = response.getData(); for (DeletedAnnotation deletedAnnotation : deletedAnnotations) { System.out.println("Annotation ID: " + deletedAnnotation.getAnnotationId()); System.out.println("Doc Id: " + deletedAnnotation.getDocumentId()); System.out.println("Major Version: " + deletedAnnotation.getMajorVersion()); System.out.println("Minor Version: " + deletedAnnotation.getMinorVersion()); }
public DocumentAnnotationRequest setBinaryFile(String filename, byte[] binaryContent)
filename
- file name (no path)binaryContent
- byte array of the file contentpublic DocumentAnnotationRequest setInputPath(String inputPath)
inputPath
- Absolute path to the file for the requestpublic DocumentAnnotationRequest setOutputPath(String outputPath)
outputPath
- Absolute path to the file for the responsepublic DocumentAnnotationRequest setOffset(Integer offset)
offset
- Amount of offset from the first record returnedpublic DocumentAnnotationRequest setLimit(Integer limit)
limit
- Max number of resultspublic DocumentAnnotationRequest setPaginationId(String paginationId)
paginationId
- The pagination idpublic DocumentAnnotationRequest setAnnotationTypes(Set<String> annotationTypes)
annotationTypes
- A set of annotation typespublic DocumentAnnotationRequest setContentTypeCsv()
public DocumentAnnotationRequest setContentTypeJson()
public DocumentAnnotationRequest setRequestString(String requestString)
requestString
- The source request as a stringCopyright © 2024. All rights reserved.