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 Details

  • 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.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

      public ObjectRecordAttachmentFieldExportResponse exportAttachmentFieldFiles(String objectName)
      Export Attachment Field Files

      Export 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 Results

      Retrieve the results of the job requested by the Export Attachment Field Files endpoint.

      Parameters:
      objectName - object name__v field value
      jobId - 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

      public VaultResponse downloadAttachmentFieldFilesExport(String objectName, String filePartName)
      Download Attachment Field Files Export

      Download the export file parts generated by Export Attachment Field Files.

      Parameters:
      objectName - The object name__v field value
      filePartName - 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 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.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

      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.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

      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
    • setContentTypeCsv

      public ObjectRecordAttachmentFieldRequest setContentTypeCsv()
      Set the Header Content Type to CSV
      Returns:
      The Request
    • setContentTypeJson

      public ObjectRecordAttachmentFieldRequest setContentTypeJson()
      Set the Header Content Type to JSON
      Returns:
      The Request
    • setRequestString

      public ObjectRecordAttachmentFieldRequest setRequestString(String requestString)
      Specify source data in an input string, such as a JSON request
      Parameters:
      requestString - The source request as a string
      Returns:
      The Request
    • setIdParam

      public ObjectRecordAttachmentFieldRequest setIdParam(String idParam)
      Specify an UPSERT operation via the idParam
      Parameters:
      idParam - External Id field API name for the UPSERT
      Returns:
      The Request
    • setFieldNames

      public ObjectRecordAttachmentFieldRequest setFieldNames(Set<String> fieldNames)
      Specify field names to retrieve attached files from
      Parameters:
      fieldNames - Set of object field names
      Returns:
      The Request