Class ObjectRecordAttachmentFieldRequest
java.lang.Object
com.veeva.vault.vapil.api.request.VaultRequest<ObjectRecordAttachmentFieldRequest>
com.veeva.vault.vapil.api.request.ObjectRecordAttachmentFieldRequest
public class ObjectRecordAttachmentFieldRequest
extends VaultRequest<ObjectRecordAttachmentFieldRequest>
Object Record Attachment Field requests
- Vault API Coverage:
- https://developer.veevavault.com/api/25.3/#attachment-fields
-
Field Summary
FieldsFields inherited from class com.veeva.vault.vapil.api.request.VaultRequest
HTTP_HEADER_AUTHORIZATION, HTTP_HEADER_REFERENCE_ID, HTTP_HEADER_VAULT_CLIENT_ID, referenceId, requestClientId, vaultClient -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondownloadAllAttachmentFieldFiles(String objectName, String recordId) Download All Attachment Field FilesdownloadAttachmentFieldFile(String objectName, String recordId, String attachmentFieldName) Download Attachment Field FiledownloadAttachmentFieldFilesExport(String objectName, String filePartName) Download Attachment Field Files ExportexportAttachmentFieldFiles(String objectName) Export Attachment Field FilesretrieveAttachmentFieldFilesExportResults(String objectName, String jobId) Retrieve Attachment Field Files Export ResultssetBinaryFile(String filename, byte[] binaryContent) Specify source data in an input fileSet the Header Content Type to CSVSet the Header Content Type to JSONsetFieldNames(Set<String> fieldNames) Specify field names to retrieve attached files fromsetIdParam(String idParam) Specify an UPSERT operation via the idParamsetInputPath(String inputPath) Specify source data in an input filesetOutputPath(String outputPath) Specify source data in an output filesetRequestString(String requestString) Specify source data in an input string, such as a JSON requestupdateAttachmentFieldFile(String objectName, String recordId, String attachmentFieldName) Update Attachment Field FileMethods inherited from class com.veeva.vault.vapil.api.request.VaultRequest
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setHeaderClientId, setHeaderReferenceId, setVaultClient
-
Field Details
-
ID_PARAM
- See Also:
-
-
Constructor Details
-
ObjectRecordAttachmentFieldRequest
public ObjectRecordAttachmentFieldRequest()
-
-
Method Details
-
downloadAttachmentFieldFile
public VaultResponse downloadAttachmentFieldFile(String objectName, String recordId, String attachmentFieldName) Download Attachment Field FileDownload the specified Attachment field file from an object record.
- Parameters:
objectName- The object name__v field valuerecordId- The object record id field valueattachmentFieldName- The name of the Attachment field from which to retrieve the file- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/{version}/vobjects/{object_name}/{object_record_id}/attachment_fields/{attachment_field_name}/file- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#download-attachment-field-file
- Example Request:
Example 1 - Download Binary Content VaultResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .downloadAttachmentFieldFile(objectName, recordId, attachmentFieldName); Example 2 - Download to File VaultResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setOutputPath(outputPath) .downloadAttachmentFieldFile(objectName, recordId, attachmentFieldName);- Example Response:
System.out.println("Content-Type: " + response.getHeaderContentType()); System.out.println("Content-Disposition: " + response.getHttpHeaderContentDisposition());
-
exportAttachmentFieldFiles
Export Attachment Field FilesExport all Attachment field files in bulk from the specified object records. This endpoint starts a job to create a tar.gz export file for later retrieval.
- Parameters:
objectName- The object name__v field value- Returns:
- ObjectRecordAttachmentFieldExportResponse
- Vault API Endpoint:
POST /api/{version}/vobjects/{object_name}/attachment_fields/actions/export- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#export-attachment-field-files
- Example Request:
Example 1 - From Request String ObjectRecordAttachmentFieldExportResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setContentTypeJson() .setFieldNames(fieldNames) .setRequestString(jsonString) .exportAttachmentFieldFiles(OBJECT_NAME); Example 2 - From Input File ObjectRecordAttachmentFieldExportResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setContentTypeJson() .setFieldNames(fieldNames) .setInputPath(inputPath) .exportAttachmentFieldFiles(OBJECT_NAME); Example 3 - From Binary ObjectRecordAttachmentFieldExportResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setContentTypeJson() .setFieldNames(fieldNames) .setBinaryFile("export_attachment_field_files.json", bytesArray) .exportAttachmentFieldFiles(OBJECT_NAME);- Example Response:
System.out.println("Job ID: " + response.getData().getJobId()); for (ObjectRecordAttachmentFieldExportResponse.Data.ExportResult exportResult : response.getData().getRecords()) { System.out.println("-----Object Record-----"); System.out.println("Response Status: " + exportResult.getResponseStatus()); System.out.println("Record ID: " + exportResult.getData().getId()); System.out.println("ID Param Value: " + exportResult.getData().getIdParamValue()); }
-
retrieveAttachmentFieldFilesExportResults
public ObjectRecordAttachmentFieldExportResultsResponse retrieveAttachmentFieldFilesExportResults(String objectName, String jobId) Retrieve Attachment Field Files Export ResultsRetrieve the results of the job requested by the Export Attachment Field Files endpoint.
- Parameters:
objectName- object name__v field valuejobId- export job id- Returns:
- ObjectRecordAttachmentFieldExportResultsResponse
- Vault API Endpoint:
GET /api/{version}/vobjects/{object_name}/attachment_fields/actions/export/{job_id}/results- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#retrieve-attachment-field-files-export-results
- Example Request:
ObjectRecordAttachmentFieldExportResultsResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .retrieveAttachmentFieldFilesExportResults(OBJECT_NAME, jobId);- Example Response:
System.out.println("File Name: " + response.getData().getFilename()); System.out.println("File Size: " + response.getData().getSize()); System.out.println("Fileparts: " + response.getData().getFileparts()); for (ObjectRecordAttachmentFieldExportResultsResponse.Data.FilePart filePart : response.getData().getFilepartDetails()) { System.out.println("-----File Part-----"); System.out.println("File Part Filename: " + filePart.getFilename()); System.out.println("File Part Size: " + filePart.getSize()); }
-
downloadAttachmentFieldFilesExport
Download Attachment Field Files ExportDownload the export file parts generated by Export Attachment Field Files.
- Parameters:
objectName- The object name__v field valuefilePartName- The name of the file part to download.- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/{version}/vobjects/{object_name}/attachment_fields/files/{file_part_name}- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#download-attachment-field-files-export
- Example Request:
VaultResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .downloadAttachmentFieldFilesExport(OBJECT_NAME, filePartName);- Example Response:
System.out.println("Content-Type: " + response.getHeaderContentType()); System.out.println("Content-Disposition: " + response.getHttpHeaderContentDisposition());
-
updateAttachmentFieldFile
public ObjectRecordBulkResponse updateAttachmentFieldFile(String objectName, String recordId, String attachmentFieldName) Update Attachment Field File
Update an Attachment field by uploading a file. If you need to update more than one Attachment field, it is best practice to update in bulk with Update Object Records.
- Parameters:
objectName- The object name__v field valuerecordId- The object record id field valueattachmentFieldName- The name of the Attachment field to update- Returns:
- ObjectRecordBulkResponse
- Vault API Endpoint:
POST /api/{version}/vobjects/{object_name}/{object_record_id}/attachment_fields/{attachment_field_name}/file- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#update-attachment-field-file
- Example Request:
Example 1 - Upload from input path ObjectRecordBulkResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setInputPath(inputPath) .updateAttachmentFieldFile(objectName, recordId, attachmentFieldName); Example 2 - Upload bytes ObjectRecordBulkResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setBinaryFile("test_binary_file.txt", bytesArray) .updateAttachmentFieldFile(objectName, recordId, attachmentFieldName);- Example Response:
for (ObjectRecordResponse objectRecordResponse : response.getData()) { System.out.println("Response Status: " + objectRecordResponse.getResponseStatus()); System.out.println("Record ID: " + objectRecordResponse.getData().getId()); System.out.println("Record URL: " + objectRecordResponse.getData().getUrl()); }
-
downloadAllAttachmentFieldFiles
Download All Attachment Field FilesDownload all Attachment field files from the specified object record.
- Parameters:
objectName- The object name__v field valuerecordId- The object record id field value- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/{version}/vobjects/{object_name}/{object_record_id}/attachment_fields/file- Vault API Help Link:
- https://developer.veevavault.com/api/25.3/#download-all-attachment-field-files
- Example Request:
Example 1 - Download Binary Content VaultResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .downloadAllAttachmentFieldFiles(objectName, recordId); Example 2 - Download to File VaultResponse response = vaultClient.newRequest(ObjectRecordAttachmentFieldRequest.class) .setOutputPath(outputPath) .downloadAllAttachmentFieldFiles(objectName, recordId);- Example Response:
System.out.println("Content-Type: " + response.getHeaderContentType()); System.out.println("Content-Disposition: " + response.getHttpHeaderContentDisposition());
-
setBinaryFile
Specify source data in an input file- Parameters:
filename- file name (no path)binaryContent- byte array of the file content- Returns:
- The Request
-
setInputPath
Specify source data in an input file- Parameters:
inputPath- Absolute path to the file for the request- Returns:
- The Request
-
setOutputPath
Specify source data in an output file- Parameters:
outputPath- Absolute path to the file for the response- Returns:
- The Request
-
setContentTypeCsv
Set the Header Content Type to CSV- Returns:
- The Request
-
setContentTypeJson
Set the Header Content Type to JSON- Returns:
- The Request
-
setRequestString
Specify source data in an input string, such as a JSON request- Parameters:
requestString- The source request as a string- Returns:
- The Request
-
setIdParam
Specify an UPSERT operation via the idParam- Parameters:
idParam- External Id field API name for the UPSERT- Returns:
- The Request
-
setFieldNames
Specify field names to retrieve attached files from- Parameters:
fieldNames- Set of object field names- Returns:
- The Request
-