The VAPIL release cycle follows the Vault API release cycle, with three general releases a year. Each VAPIL release aligns with the features of the Vault API release for consistency and coverage.
- Vault API version v22.2 is released, VAPIL version v22.2.0 is released
- When defects are fixed, VAPIL version v22.2.1, v22.2.2, etc will be released
- Vault API version v22.3 is released, VAPIL version v22.3.0 is released
- One solution to develop and support
- Consistent development patterns that are similar the Vault Java SDK
- Full coverage of all platform API endpoints
- Expose API requests/responses in clearly defined Java classes, getters, setters, and methods
- Easily find API endpoints from Vault help webpage in the source or Javadoc
- One-to-one alignment between VAPIL methods and the Vault API endpoint/documentation
- Easy to start, quick to build
- Allow integration developer full control of design/implementation decisions, processing rules, exception handling
VAPIL developers are responsible for:
- Following integration best practices with Vault and related systems
- Using bulk and batch processes whenever possible
- Respecting API authentication and burst limits
- Exception handling
- Import VAPIL to a Maven project by adding the following to the project pom.xml file
<repositories> <repository> <id>vapil</id> <url>https://veeva.github.io/vault-api-library/maven</url> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> </repository> </repositories> <dependencies> <dependency> <groupId>com.veeva.vault</groupId> <artifactId>vapil</artifactId> <version>24.2.0</version> </dependency> </dependencies>
- Create a class "HelloWorld" and add the following code
public class HelloWorld { public static void main(String[] args) { // Set the Vault Client Id, which is required for all API calls String vaultClientId = "verteobiotech-vault-quality-client-myintegration"; // Instantiate the VAPIL VaultClient using user name and password authentication VaultClient vaultClient = VaultClient .newClientBuilder(VaultClient.AuthenticationType.BASIC) .withVaultDNS("verteobiotech.veevavault.com") .withVaultUsername("username@verteobiotech.com") .withVaultPassword("password") .withVaultClientId(vaultClientId) .build(); // Perform a VQL query and display the results QueryResponse resp = vaultClient.newRequest(QueryRequest.class) .query("SELECT name__v, email__sys FROM user__sys MAXROWS 3"); if (resp != null) { System.out.println("-----------------------------------------"); System.out.println("Response Status = " + resp.getResponseStatus()); System.out.println("Total Records = " + resp.getData().size()); for (QueryResponse.QueryResult row : resp.getData()) System.out.println("Name = " + row.get("name__v") + ", Email = " + row.get("email__sys")); } } }
- Run the code and verify the results
----------------------------------------- Response Status = SUCCESS Total Records = 3 Name = System, Email = System Name = Todd Taylor, Email = todd.taylor@verteobiotech.com Name = Mark Arnold, Email = mark.arnold@verteobiotech.com
- Now that you have a starting point, check out the sample code and go build your interface!
Instantiate the Vault Client with an Existing Session
String vaultClientId = "verteobiotech-vault-quality-client-myintegration"; String sessionId = "xxxxxxxxxxxxxxxxx"; VaultClient vaultClient = VaultClient .newClientBuilder(VaultClient.AuthenticationType.SESSION_ID) .withVaultDNS("verteobiotech.veevavault.com") .withVaultSessionId(sessionId) .withVaultClientId(vaultClientId) .build();
Instantiate the Vault Client from a JSON settings file
- Store a JSON file on your local machine in the following format
{ "authenticationType": "BASIC", "idpOauthAccessToken": "", "idpOauthScope": "openid", "idpUsername": "", "idpPassword": "", "vaultUsername": "username@verteobiotech.com", "vaultPassword": "password", "vaultDNS": "verteobiotech.veevavault.com", "vaultSessionId": "", "vaultClientId": "verteobiotech-vault-quality-client-myintegration", "vaultOauthClientId": "", "vaultOauthProfileId": "", "logApiErrors": true, "httpTimeout": null, "validateSession": true }
- Reference the JSON file when building the client
File settingsFile = new File("settings.json"); VaultClient vaultClient = VaultClient .newClientBuilderFromSettings(settingsFile) .build();
Create a Single Document
Document doc = new Document(); doc.setName("VAPIL Single Document"); doc.setLifecycle("General Lifecycle"); doc.setType("General"); doc.setTitle("Test Upload VAPIL"); doc.set("custom_field__c", "value"); DocumentResponse documentResponse = vaultClient.newRequest(DocumentRequest.class) .setInputPath(filePath) .createSingleDocument(doc);
Bulk Create Multiple Documents from CSV File
DocumentBulkResponse documentResponse = vaultClient.newRequest(DocumentRequest.class) .setInputPath(csvFilePath) .createMultipleDocuments();
Bulk Update Object Records (Input CSV, JSON Response)
ObjectRecordBulkResponse objectResponse = vaultClient.newRequest(ObjectRecordRequest.class) .setContentTypeCsv() .setInputPath(localPath) .updateObjectRecords("product__v");
Retrieve the Audit Trail for Documents in past 30 days
DocumentAuditResponse auditResponse = vaultClient.newRequest(LogRequest.class) .setStartDateTime(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(29)) .setEndDateTime(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)) .setLimit(4) .retrieveAuditDetails(LogRequest.AuditTrailType.DOCUMENT); AuditDetailsResponse.ResponseDetails details = auditResponse.getResponseDetails(); System.out.println("Offset = " + details.getOffset()); System.out.println("Limit = " + details.getLimit()); System.out.println("Size = " + details.getSize()); System.out.println("Total = " + details.getTotal()); System.out.println("Object/Name = " + details.getDetailsObject().getName()); System.out.println("Object/Label = " + details.getDetailsObject().getLabel()); System.out.println("Object/Url = " + details.getDetailsObject().getUrl()); System.out.println("Items ****"); for (DocumentAuditResponse.DocumentAudit audit : auditResponse.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + audit.getId()); System.out.println("timestamp = " + audit.getTimestamp()); System.out.println("UserName = " + audit.getUserName()); System.out.println("Full Name = " + audit.getFullName()); System.out.println("Action = " + audit.getAction()); System.out.println("Item = " + audit.getItem()); System.out.println("Field Name = " + audit.getFieldName()); System.out.println("Workflow Name = " + audit.getWorkflowName()); System.out.println("Task Name = " + audit.getTaskName()); System.out.println("Signature Meaning = " + audit.getSignatureMeaning()); System.out.println("View License = " + audit.getViewLicense()); System.out.println("Job Instance ID = " + audit.getJobInstanceId()); System.out.println("Doc ID = " + audit.getDocId()); System.out.println("Version = " + audit.getVersion()); System.out.println("Document Url = " + audit.getDocumentUrl()); System.out.println("Event Description = " + audit.getEventDescription()); }