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.1/#attachment-fields
  • Constructor Details

    • ObjectRecordAttachmentFieldRequest

      public ObjectRecordAttachmentFieldRequest()
  • Method Details

    • downloadAttachmentFieldFile

      public VaultResponse downloadAttachmentFieldFile(String objectName, String recordId, String attachmentFieldName)
      Download Attachment Field File

      Download the specified Attachment field file from an object record.

      Parameters:
      objectName - The object name__v field value
      recordId - The object record id field value
      attachmentFieldName - 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.1/#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());
       
    • 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 value
      recordId - The object record id field value
      attachmentFieldName - 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.1/#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

      public VaultResponse downloadAllAttachmentFieldFiles(String objectName, String recordId)
      Download All Attachment Field Files

      Download all Attachment field files from the specified object record.

      Parameters:
      objectName - The object name__v field value
      recordId - 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.1/#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

      public ObjectRecordAttachmentFieldRequest setBinaryFile(String filename, byte[] binaryContent)
      Specify source data in an input file
      Parameters:
      filename - file name (no path)
      binaryContent - byte array of the file content
      Returns:
      The Request
    • setInputPath

      public ObjectRecordAttachmentFieldRequest setInputPath(String inputPath)
      Specify source data in an input file
      Parameters:
      inputPath - Absolute path to the file for the request
      Returns:
      The Request
    • setOutputPath

      public ObjectRecordAttachmentFieldRequest setOutputPath(String outputPath)
      Specify source data in an output file
      Parameters:
      outputPath - Absolute path to the file for the response
      Returns:
      The Request