Class LogRequest
- Vault API Coverage:
- https://developer.veevavault.com/api/25.1/#logs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Enum for the various audit trail formatsstatic enum
JSON or CSV Result Typesstatic enum
log_format for the api_usage request -
Field Summary
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptioncreateDebugLog
(String name, String userId) Create Debug LogcreateProfilingSession
(String label) Create Profiling SessiondeleteDebugLog
(String id) Delete Debug LogdeleteProfilingSession
(String sessionName) Delete Profiling SessionDownload Debug Log FilesdownloadProfilingSessionResults
(String sessionName) Download Profiling Session ResultsdownloadSdkRuntimeLog
(LocalDate logDate) Download SDK Runtime LogendProfilingSession
(String sessionName) End Profiling SessionresetDebugLog
(String id) Reset Debug LogRetrieve All Debug LogsRetrieve All Profiling Sessions<T> T
retrieveAuditDetails
(LogRequest.AuditTrailType auditTrailType) Retrieve Audit Details<T> T
retrieveAuditDetailsByPage
(LogRequest.AuditTrailType auditTrailType, String pageUrl) Retrieve Audit Details (By Page)retrieveAuditMetadata
(LogRequest.AuditTrailType auditTrailType) Retrieve Audit MetadataRetrieve Audit TypesRetrieve Complete Audit History for a Single DocumentretrieveCompleteAuditHistoryForASingleObjectRecord
(String objectName, String recordId) Retrieve Complete Audit History for a Single Object RecordretrieveDailyAPIUsage
(LocalDate logDate) Retrieve Daily API Usage<T> T
Retrieve Email Notification HistoryretrieveProfilingSession
(String sessionName) Retrieve Profiling SessionRetrieve Single Debug LogsetAllDates
(Boolean allDates) Used to request audit information for all datessetClassFilters
(Set<String> classFilters) Specify class filters when creating SDK debug log sessionssetDescription
(String description) Specify an Admin-facing description of the sessionsetEndDate
(LocalDate endDate) Specify an end date to retrieve email notification history.setEndDateTime
(ZonedDateTime endDate) Specify an end date and time to retrieve audit information or email notification historySpecify audit events when retrieving object or documents audit trailssetFormatResult
(LogRequest.FormatResultType formatResult) The format of the returned results (JSON or CSV)setIncludeInactive
(boolean includeInactive) Specify whether to include inactive sessions in SDK Debug requestsThe maximum number of results to returnsetLogFormat
(LogRequest.LogFormatType logFormat) Specify the format to downloadsetLogLevel
(String logLevel) Specify log level for SDK Debug Log session.setObjects
(Set<String> objects) Specify object names when retrieving object audit trailssetOutputPath
(String outputPath) Specify source data in an output filesetStartDate
(LocalDate startDate) Specify a start date to retrieve email notification history.setStartDateTime
(ZonedDateTime startDate) Specify a start date and time to retrieve audit information or email notification historySpecify the user ID for SDK Profiling and Debug requestsMethods inherited from class com.veeva.vault.vapil.api.request.VaultRequest
getBaseObjectMapper, send, send, sendReturnBinary, sendReturnBinary, sendToFile, sendToFile, setHeaderClientId, setHeaderReferenceId, setVaultClient
-
Method Details
-
retrieveAuditTypes
Retrieve Audit TypesRetrieves all available audit types you have permission to access.
- Returns:
- AuditTypesResponse
- Vault API Endpoint:
GET /api/{version}/metadata/audittrail
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-audit-types
- Example Request:
AuditTypesResponse resp = vaultClient.newRequest(LogRequest.class) .retrieveAuditTypes();
- Example Response:
for (AuditType a : resp.getAuditTypes()) { System.out.println("Name = " + a.getName()); System.out.println("Label = " + a.getLabel()); System.out.println("Url = " + a.getUrl()); }
-
retrieveAuditMetadata
Retrieve Audit MetadataRetrieve all fields and their metadata for a specified audit trail or log type.
- Parameters:
auditTrailType
- The name of the specified audit type (The AuditTrailType enum values translate to document_audit_trail, object_audit_trail, etc.).- Returns:
- AuditMetadataResponse
- Vault API Endpoint:
GET /api/{version}/metadata/audittrail/{audit_trail_type}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-audit-metadata
- Example Request:
AuditMetadataResponse resp = vaultClient.newRequest(LogRequest.class) .retrieveAuditMetadata(LogRequest.AuditTrailType.DOCUMENT);
- Example Response:
AuditMetadata metadata = resp.getData(); System.out.println("Name = " + metadata.getName()); System.out.println("Label = " + metadata.getLabel()); System.out.println("Fields ****"); for (AuditMetadata.Field f : metadata.getFields()) { System.out.println("**** Field **** "); System.out.println("Name = " + f.getName()); System.out.println("Label = " + f.getLabel()); System.out.println("Type = " + f.getType()); }
-
retrieveAuditDetails
Retrieve Audit DetailsRetrieve audit details for a specific audit type. This request supports parameters to narrow the results to specific audit events, or a specified date and time within the past 30 days.
NOTE: Only returns the first page; use retrieveAuditDetailsByPage paginate through previous and next pages
- Type Parameters:
T
- Response Type class- Parameters:
auditTrailType
- The name of the specified audit type (The AuditTrailType enum values translate to document_audit_trail, object_audit_trail, etc.).- Returns:
- Returns one of the following:
SystemAuditResponse when auditTrailType is system_audit_trail
LoginAuditResponse when auditTrailType is login_audit_trail
ObjectAuditResponse when auditTrailType is object_audit_trail
DomainAuditResponse when auditTrailType is domain_audit_trail
DocumentAuditResponse when auditTrailType is document_audit_response JobCreateResponse when format result is CSV - Vault API Endpoint:
GET /api/{version}/audittrail/{audit_trail_type}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-audit-details
- Example Request:
Example 1 - DocumentAuditResponse DocumentAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setStartDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(29)) .setEndDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)) .setLimit(4) .setEvents(new HashSet<>(Arrays.asList("UploadDocBulk", "ExportBinder"))) .retrieveAuditDetails(LogRequest.AuditTrailType.DOCUMENT);
,Example 3 - DomainAuditResponse DomainAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setStartDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(10)) .retrieveAuditDetails(LogRequest.AuditTrailType.DOMAIN);
,Example 3 - LoginAuditResponse LoginAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setStartDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(10)) .retrieveAuditDetails(LogRequest.AuditTrailType.LOGIN);
,Example 4 - ObjectAuditResponse ObjectAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setStartDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(10)) .setEvents(new HashSet<>(Arrays.asList("Create", "Update"))) .retrieveAuditDetails(LogRequest.AuditTrailType.OBJECT);
,Example 5 - JobCreateResponse JobCreateResponse resp = vaultClient.newRequest(LogRequest.class) .setAllDates(true) .setFormatResult(LogRequest.FormatResultType.CSV) .retrieveAuditDetails(LogRequest.AuditTrailType.DOMAIN);
- Example Response:
Example 1 - DocumentAuditResponse AuditDetailsResponse.ResponseDetails details = resp.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 (DocumentAuditData data : resp.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserName = " + data.getUserName()); System.out.println("Full Name = " + data.getFullName()); System.out.println("Action = " + data.getAction()); System.out.println("Item = " + data.getItem()); System.out.println("Field Name = " + data.getFieldName()); System.out.println("Workflow Name = " + data.getWorkflowName()); System.out.println("Task Name = " + data.getTaskName()); System.out.println("Signature Meaning = " + data.getSignatureMeaning()); System.out.println("View License = " + data.getViewLicense()); System.out.println("Job Instance ID = " + data.getJobInstanceId()); System.out.println("Doc ID = " + data.getDocId()); System.out.println("Version = " + data.getVersion()); System.out.println("Document Url = " + data.getDocumentUrl()); System.out.println("Event Description = " + data.getEventDescription()); }
,Example 2 - DomainAuditResponse AuditDetailsResponse.ResponseDetails details = resp.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 (DomainAuditData data : resp.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserId = " + data.getUserId()); System.out.println("UserName = " + data.getUserName()); System.out.println("Full Name = " + data.getFullName()); System.out.println("Action = " + data.getAction()); System.out.println("Type = " + data.getType()); System.out.println("Item = " + data.getItem()); System.out.println("FieldName = " + data.getFieldName()); System.out.println("NewValue = " + data.getNewValue()); System.out.println("EventDescription = " + data.getEventDescription()); }
,Example 3 - LoginAuditResponse AuditDetailsResponse.ResponseDetails details = resp.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 (LoginAuditData data : resp.getDataw()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserName = " + data.getUserName()); System.out.println("Source IP = " + data.getSourceIp()); System.out.println("Type = " + data.getType()); System.out.println("Status = " + data.getStatus()); System.out.println("Browser = " + data.getBrowser()); System.out.println("Platform = " + data.getPlatform()); System.out.println("Vault ID = " + data.getVaultId()); }
,Example 4 - ObjectAuditResponse AuditDetailsResponse.ResponseDetails details = resp.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 (ObjectAuditData data : resp.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserName = " + data.getUserName()); System.out.println("Full Name = " + data.getFullName()); System.out.println("Action = " + data.getAction()); System.out.println("Item = " + data.getItem()); System.out.println("Record ID = " + data.getRecordId()); System.out.println("Object Label = " + data.getObjectLabel()); System.out.println("Workflow Name = " + data.getWorkflowName()); System.out.println("Task Name = " + data.getTaskName()); System.out.println("Verdict = " + data.getVerdict()); System.out.println("Reason = " + data.getReason()); System.out.println("Capacity = " + data.getCapacity()); System.out.println("Event Description = " + data.getEventDescription()); }
,Example 5 - JobCreateResponse System.out.println("Response Status = " + resp.getResponseStatus()); System.out.println("Job ID = " + resp.getJobId()); System.out.println("Url = " + resp.getUrl());
-
retrieveAuditDetailsByPage
Retrieve Audit Details (By Page)Retrieve next or previous page of an existing audit details request
- Type Parameters:
T
- Response Type class- Parameters:
auditTrailType
- type of audit trailpageUrl
- The URL from the previous_page or next_page parameter- Returns:
- Returns one of the following:
SystemAuditResponse when auditTrailType is system_audit_trail
LoginAuditResponse when auditTrailType is login_audit_trail
ObjectAuditResponse when auditTrailType is object_audit_trail
DomainAuditResponse when auditTrailType is domain_audit_trail
DocumentAuditResponse when auditTrailType is document_audit_response - Vault API Endpoint:
GET /api/{version}/metadata/audittrail/{audit_trail_type}?offset={val}&limit={val}&uuid={val}
-
retrieveCompleteAuditHistoryForASingleDocument
Retrieve Complete Audit History for a Single DocumentRetrieve complete audit history for a single document.
- Parameters:
docId
- The Document Id- Returns:
- DocumentAuditResponse
- Vault API Endpoint:
GET /api/{version}/objects/documents/{doc_id}/audittrail
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-complete-audit-history-for-a-single-document
- Example Request:
DocumentAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setLimit(4) // Just pull 4 records so the results can be viewed more easily .setFormatResult(LogRequest.FormatResultType.JSON) .setEvents(new HashSet<>(Arrays.asList("GetDocumentVersion", "UploadDoc"))) .retrieveCompleteAuditHistoryForASingleDocument(id);
- Example Response:
AuditDetailsResponse.ResponseDetails details = resp.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 (DocumentAuditData data : resp.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserName = " + data.getUserName()); System.out.println("Full Name = " + data.getFullName()); System.out.println("Action = " + data.getAction()); System.out.println("Item = " + data.getItem()); System.out.println("Field Name = " + data.getFieldName()); System.out.println("New Value = " + data.getNewValue()); System.out.println("Workflow Name = " + data.getWorkflowName()); System.out.println("Task Name = " + data.getTaskName()); System.out.println("Signature Meaning = " + data.getSignatureMeaning()); System.out.println("View License = " + data.getViewLicense()); System.out.println("Job Instance ID = " + data.getJobInstanceId()); System.out.println("Doc ID = " + data.getDocId()); System.out.println("Version = " + data.getVersion()); System.out.println("Document Url = " + data.getDocumentUrl()); System.out.println("Event Description = " + data.getEventDescription()); }
-
retrieveCompleteAuditHistoryForASingleObjectRecord
public ObjectAuditResponse retrieveCompleteAuditHistoryForASingleObjectRecord(String objectName, String recordId) Retrieve Complete Audit History for a Single Object RecordRetrieve Complete Audit History for a Single Object Record.
- Parameters:
objectName
- Object namerecordId
- Object record id- Returns:
- ObjectAuditResponse
- Vault API Endpoint:
GET /api/{version}/vobjects/{object_name}/{object_record_id}/audittrail
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-complete-audit-history-for-a-single-object-record
- Example Request:
ObjectAuditResponse resp = vaultClient.newRequest(LogRequest.class) .setFormatResult(LogRequest.FormatResultType.JSON) .setEvents(new HashSet<>(Arrays.asList("Create", "Edit"))) .retrieveCompleteAuditHistoryForASingleObjectRecord("product__v", "00P000000000601");
- Example Response:
if (resp.isSuccessful()) { AuditDetailsResponse.ResponseDetails details = resp.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 (ObjectAuditData data : resp.getData()) { System.out.println("\n**** Data Item **** "); System.out.println("id = " + data.getId()); System.out.println("timestamp = " + data.getTimestamp()); System.out.println("UserName = " + data.getUserName()); System.out.println("Full Name = " + data.getFullName()); System.out.println("Action = " + data.getAction()); System.out.println("Item = " + data.getItem()); System.out.println("Record ID = " + data.getRecordId()); System.out.println("Object Label = " + data.getObjectLabel()); System.out.println("Workflow Name = " + data.getWorkflowName()); System.out.println("Task Name = " + data.getTaskName()); System.out.println("Verdict = " + data.getVerdict()); System.out.println("Reason = " + data.getReason()); System.out.println("Capacity = " + data.getCapacity()); System.out.println("Event Description = " + data.getEventDescription()); } }
-
retrieveEmailNotificationHistory
public <T> T retrieveEmailNotificationHistory()Retrieve Email Notification HistoryRetrieve details about the email notifications sent by Vault. Details include the notification date, recipient, subject, and delivery status.
- Type Parameters:
T
- Response Type class- Returns:
- Returns one of the following:
EmailNotificationHistoryResponse JobCreateResponse when format result is CSV - Vault API Endpoint:
GET /api/{version}/notifications/histories
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-email-notification-histories
- Example Request:
Example 1 - EmailNotificationHistoryResponse EmailNotificationHistoryResponse response = vaultClient.newRequest(LogRequest.class) .retrieveEmailNotificationHistory();
,Example 2 - EmailNotificationHistoryResponse EmailNotificationHistoryResponse response = vaultClient.newRequest(LogRequest.class) .setStartDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(29)) .setEndDate(ZonedDateTime.now(ZoneId.of("UTC")).minusDays(1)) .retrieveEmailNotificationHistory();
,Example 3 - JobCreateResponse JobCreateResponse response = vaultClient.newRequest(LogRequest.class) .setAllDates(true) .setFormatResult(LogRequest.FormatResultType.CSV) .retrieveEmailNotificationHistory();
- Example Response:
Example 1 - EmailNotificationHistoryResponse System.out.println("Response Status: " + response.getResponseStatus()); System.out.println("Response Message: " + response.getResponse()); EmailNotificationHistoryResponse.ResponseDetails details = response.getResponseDetails(); System.out.println("Response Details ****"); 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("Items ****"); for (EmailNotification data : response.getData()) { System.out.println("id = " + data.getNotificationId()); System.out.println("Send Date = " + data.getSendDate()); System.out.println("Recipient Email: " + data.getRecipientEmail()); }
,Example 2 - EmailNotificationHistoryResponse System.out.println("Response Status: " + response.getResponseStatus()); System.out.println("Response Message: " + response.getResponse()); EmailNotificationHistoryResponse.ResponseDetails details = response.getResponseDetails(); System.out.println("Response Details ****"); 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("Items ****"); for (EmailNotification data : response.getData()) { System.out.println("id = " + data.getNotificationId()); System.out.println("Send Date = " + data.getSendDate()); System.out.println("Recipient Email: " + data.getRecipientEmail()); }
,Example 3 - JobCreateResponse System.out.println("Response Status: " + response.getResponseStatus()); System.out.println("Response Message: " + response.getResponse()); System.out.println("Job ID: " + response.getJobId()); System.out.println("Url = " + resp.getUrl());
-
retrieveDailyAPIUsage
Retrieve Daily API UsageRetrieve the API Usage Log for a single day, up to 30 days in the past. The log contains information such as user name, user ID, remaining burst and daily limits, and the endpoint called. Users with the Admin > Logs > API Usage Logs permission can access these logs.
Note that if outputFilePath is set, this method will save the output to the path specified. If outputFilePath is null or empty, the output will be stored as a byte array in the VaultResponse object. If outputFilePath is set, it must include the full file path and a file name with a .zip extension
- Parameters:
logDate
- Daily log date- Returns:
- VaultResponse On SUCCESS, Vault retrieves the log from the specified date as a .ZIP file.
- Vault API Endpoint:
GET /api/{version}/logs/api_usage?date=YYYY-MM-DD
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-daily-api-usage
- Example Request:
Example 1 - To file VaultResponse response = vaultClient.newRequest(LogRequest.class) .setLogDate(date) .setOutputPath(outputFilePath.toString()) .retrieveDailyAPIUsage();
,Example 2 - To buffer VaultResponse response = vaultClient.newRequest(LogRequest.class) .setLogDate(date) .setLogFormat(LogRequest.LogFormatType.LOGFILE) .setOutputPath(null) .retrieveDailyAPIUsage();
- Example Response:
Example 2 - To buffer if (response.getResponseStatus().equals(VaultResponse.HTTP_RESPONSE_SUCCESS)) { try (OutputStream os = new FileOutputStream(outputFilePath.toString())) { os.write(response.getBinaryContent()); System.out.println("File was saved to: " + outputFilePath.toString()); } catch (IOException ignored){} }
-
downloadSdkRuntimeLog
Download SDK Runtime LogRetrieve the SDK Runtime Log for a single day, up to 30 days in the past. The log contains information such as the timestamp, user ID, execution ID, class name, depth, log level, and any messages returned. Users with the Admin > Logs > SDK Runtime Logs permission can access these logs.
Note that if outputFilePath is set, this method will save the output to the path specified. If outputFilePath is null or empty, the output will be stored as a byte array in the VaultResponse object. If outputFilePath is set, it must include the full file path and a file name with a .zip extension
- Parameters:
logDate
- Daily log date- Returns:
- VaultResponse On SUCCESS, Vault retrieves the log from the specified date as a .ZIP file.
- Vault API Endpoint:
GET /api/{version}/logs/code/runtime?date=YYYY-MM-DD
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#download-sdk-runtime-log
- Example Request:
Example 1 - To file VaultResponse response = vaultClient.newRequest(LogRequest.class) .setOutputPath(outputFilePath.toString()) .downloadSdkRuntimeLog(date);
,Example 2 - To buffer VaultResponse response = vaultClient.newRequest(LogRequest.class) .setLogFormat(LogRequest.LogFormatType.LOGFILE) .downloadSdkRuntimeLog(date);
- Example Response:
Example 2 - To buffer if (response.getResponseStatus().equals(VaultResponse.HTTP_RESPONSE_SUCCESS)) { try (OutputStream os = new FileOutputStream(outputFilePath.toString())) { os.write(response.getBinaryContent()); System.out.println("File was saved to: " + outputFilePath.toString()); } catch (IOException ignored){} }
-
retrieveAllProfilingSessions
Retrieve All Profiling SessionsList all SDK request profiling sessions in the currently authenticated Vault.
- Returns:
- SdkProfilingSessionBulkResponse
- Vault API Endpoint:
GET /api/{version}/code/profiler
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-profiling-session
- Example Request:
SdkProfilingSessionBulkResponse response = vaultClient.newRequest(LogRequest.class) .retrieveAllProfilingSessions();
- Example Response:
for (SdkProfilingSession session : response.getData()) { System.out.println(("--------Profiling Session--------")); System.out.println("ID = " + session.getId()); System.out.println("Name = " + session.getName()); System.out.println("Label = " + session.getLabel()); System.out.println("Status = " + session.getStatus()); }
-
retrieveProfilingSession
Retrieve Profiling SessionRetrieve details about a specific SDK request profiling session.
- Parameters:
sessionName
- SDK Profiling Session name- Returns:
- SdkProfilingSessionResponse
- Vault API Endpoint:
GET /api/{version}/code/profiler/{session_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-profiling-session
- Example Request:
SdkProfilingSessionResponse response = vaultClient.newRequest(LogRequest.class) .retrieveProfilingSession(PROFILING_SESSION_NAME);
- Example Response:
System.out.println("ID = " + response.getData().getId()); System.out.println("Name = " + response.getData().getName()); System.out.println("Label = " + response.getData().getLabel()); System.out.println("Status = " + response.getData().getStatus());
-
createProfilingSession
Create Profiling SessionCreate a new SDK request profiling session.
- Parameters:
label
- SDK Profiling Session label- Returns:
- SdkProfilingSessionCreateResponse
- Vault API Endpoint:
POST /api/{version}/code/profiler
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#create-profiling-session
- Example Request:
SdkProfilingSessionCreateResponse response = vaultClient.newRequest(LogRequest.class) .setUserId(USER_ID) .setDescription("Vapil Test Description") .createProfilingSession("VAPIL Test Profiling Session");
- Example Response:
System.out.println("ID = " + response.getData().getId()); System.out.println("Name = " + response.getData().getName());
-
endProfilingSession
End Profiling SessionTerminate a profiling session early. By default, profiling sessions run for either 20 minutes or up to 10,000 SDK requests, whichever comes first.
- Parameters:
sessionName
- SDK Profiling Session name- Returns:
- VaultResponse
- Vault API Endpoint:
POST /api/{version}/code/profiler/{session_name}/actions/end
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#end-profiling-session
- Example Request:
VaultResponse response = vaultClient.newRequest(LogRequest.class) .endProfilingSession(sessionName);
- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
deleteProfilingSession
Delete Profiling SessionDelete an inactive profiling session, which deletes the session and all data associated with the session. Inactive sessions have a status of complete__sys.
- Parameters:
sessionName
- SDK Profiling Session name- Returns:
- VaultResponse
- Vault API Endpoint:
DELETE /api/{version}/code/profiler/{session_name}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#delete-profiling-session
- Example Request:
VaultResponse response = vaultClient.newRequest(LogRequest.class) .deleteProfilingSession(sessionName);
- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
downloadProfilingSessionResults
Download Profiling Session ResultsDownload the Profiler Log for a specific profiling session. A profiling session log is a CSV which contains one row for each SDK request, with a maximum of 100,000 rows.
- Parameters:
sessionName
- SDK Profiling Session name- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/{version}/code/profiler/{session_name}/results
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#download-profiling-session-results
- Example Request:
Example 1 - Download to file VaultResponse response = vaultClient.newRequest(LogRequest.class) .setOutputPath(outputPath.toString()) .downloadProfilingSessionResults(PROFILING_SESSION_NAME);
Example 2 - Download to Bytes VaultResponse response = vaultClient.newRequest(LogRequest.class) .downloadProfilingSessionResults(PROFILING_SESSION_NAME); byte[] bytes = response.getBinaryContent();- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
retrieveAllDebugLogs
Retrieve All Debug LogsRetrieve all debug log sessions in the authenticated Vault.
- Returns:
- SdkDebugSessionBulkResponse
- Vault API Endpoint:
GET /api/{version}/logs/code/debug
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-all-debug-logs
- Example Request:
SdkDebugSessionBulkResponse response = vaultClient.newRequest(LogRequest.class) .setUserId(USER_ID) .setIncludeInactive(true) .retrieveAllDebugLogs();
- Example Response:
for (SdkDebugSession session : response.getData()) { System.out.println(("--------Debug Session--------")); System.out.println("ID = " + session.getId()); System.out.println("Name = " + session.getName()); System.out.println("Status = " + session.getStatus()); }
-
retrieveSingleDebugLog
Retrieve Single Debug LogGiven a debug log ID, retrieve details about this debug log.
- Parameters:
id
- SDK Debug Log ID- Returns:
- SdkDebugSessionResponse
- Vault API Endpoint:
GET /api/{version}/logs/code/debug/{id}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#retrieve-single-debug-log
- Example Request:
SdkDebugSessionResponse response = vaultClient.newRequest(LogRequest.class) .retrieveSingleDebugLog(debugLogId);
- Example Response:
SdkDebugSession session = response.getData(); System.out.println("ID = " + session.getId()); System.out.println("Name = " + session.getName()); System.out.println("Status = " + session.getStatus());
-
downloadDebugLogFiles
Download Debug Log FilesGiven a debug log ID, download all of this debug log’s files.
- Parameters:
id
- SDK Debug Log ID- Returns:
- VaultResponse
- Vault API Endpoint:
GET /api/{version}/logs/code/debug/{id}/files
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#download-debug-log-files
- Example Request:
Example 1 - Download to file VaultResponse response = vaultClient.newRequest(LogRequest.class) .setOutputPath(outputPath.toString()) .downloadDebugLogFiles(debugSessionId);
Example 2 - Download to Bytes VaultResponse response = vaultClient.newRequest(LogRequest.class) .downloadDebugLogFiles(debugSessionId); byte[] bytes = response.getBinaryContent();- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
createDebugLog
Create Debug LogCreate a new debug log session for a user.
- Parameters:
name
- The UI-friendly name for this debug loguserId
- The user who will trigger entries into this debug log- Returns:
- SdkDebugSessionCreateResponse
- Vault API Endpoint:
POST /api/{version}/logs/code/debug
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#create-debug-log
- Example Request:
SdkDebugSessionCreateResponse createDebugLogResponse = vaultClient.newRequest(LogRequest.class) .setLogLevel("info__sys") .setClassFilters(classFilters) .createDebugLog("VAPIL Test Debug", USER_ID);
- Example Response:
System.out.println("ID = " + createDebugLogResponse.getData().getId());
-
resetDebugLog
Reset Debug LogGiven a debug log ID, delete all existing log files and reset the expiration date to 30 days from today.
- Parameters:
id
- SDK Debug Log ID- Returns:
- VaultResponse
- Vault API Endpoint:
POST /api/{version}/logs/code/debug/{id}/actions/reset
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#reset-debug-log
- Example Request:
VaultResponse response = vaultClient.newRequest(LogRequest.class) .resetDebugLog(debugSessionId);
- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
deleteDebugLog
Delete Debug LogGiven a debug log ID, delete this debug log and all log files.
- Parameters:
id
- SDK Debug Log ID- Returns:
- VaultResponse
- Vault API Endpoint:
DELETE /api/{version}/logs/code/debug/{id}
- Vault API Help Link:
- https://developer.veevavault.com/api/25.1/#delete-debug-log
- Example Request:
VaultResponse response = vaultClient.newRequest(LogRequest.class) .deleteDebugLog(debugSessionId);
- Example Response:
System.out.println("Response Status = " + response.getResponseStatus());
-
setStartDateTime
Specify a start date and time to retrieve audit information or email notification history
For audit information, this date cannot be more than 30 days ago. If omitted, defaults to the last 30 days.
For email notification history, this date cannot be more than 2 years ago. If omitted, defaults to the start of the day.
- Parameters:
startDate
- Start date and time for audit information or email notification history log requests.- Returns:
- The Request
-
setEndDateTime
Specify an end date and time to retrieve audit information or email notification history
For audit information, this date cannot be more than 30 days ago. If omitted, defaults to the last 30 days.
For email notification history, this date cannot be more than 30 days away from the specified start date. If an end date has been specified, a start date must also be set.
- Parameters:
endDate
- End date and time for audit information or email notification history log requests.- Returns:
- The Request
-
setStartDate
Specify a start date to retrieve email notification history.- Parameters:
startDate
- This date cannot be more than 2 years ago. If omitted, defaults to the start of the day.- Returns:
- The Request
-
setEndDate
Specify an end date to retrieve email notification history.- Parameters:
endDate
- This date cannot be more than 30 days away from the specified start date. If an end date has been specified, a start date must also be set.- Returns:
- The Request
-
setAllDates
Used to request audit information for all dates- Parameters:
allDates
- Defaults to false. Set to true to request audit information for all dates. You must leave startDate and endDate blank when requesting an export of a full audit trail.- Returns:
- The Request
-
setFormatResult
The format of the returned results (JSON or CSV)- Parameters:
formatResult
- To request a downloadable CSV file of your audit details, use FormatResultType.CSV. The response contains a jobId to retrieve the job status, which contains a link to download the CSV file. If omitted, the API returns a JSON response and does not start a job. If allDates is true, this parameter is required.- Returns:
- The Request
-
setLimit
The maximum number of results to return- Parameters:
limit
- Limits the number of results (default is 200). For larger sets, consider using CSV.- Returns:
- The Request
-
setLogFormat
Specify the format to download- Parameters:
logFormat
- Possible values are csv or logfile. If omitted, defaults to csv. Note that this call always downloads a ZIP file. This parameter only changes the format of the file contained within the ZIP.- Returns:
- The Request
-
setOutputPath
Specify source data in an output file- Parameters:
outputPath
- Absolute path to the file for the response- Returns:
- The Request
-
setEvents
Specify audit events when retrieving object or documents audit trails- Parameters:
events
- Comma-separated list of one or more audit events- Returns:
- The Request
-
setObjects
Specify object names when retrieving object audit trails- Parameters:
objects
- Comma-separated list of one or more objects- Returns:
- The Request
-
setUserId
Specify the user ID for SDK Profiling and Debug requests- Parameters:
userId
- User ID- Returns:
- The Request
-
setDescription
Specify an Admin-facing description of the session- Parameters:
description
- description- Returns:
- The Request
-
setIncludeInactive
Specify whether to include inactive sessions in SDK Debug requests- Parameters:
includeInactive
- Include inactive sessions in the response. Defaults to false.- Returns:
- The Request
-
setLogLevel
Specify log level for SDK Debug Log session.- Parameters:
logLevel
- The level of error messages to capture in this log- Returns:
- The Request
-
setClassFilters
Specify class filters when creating SDK debug log sessions- Parameters:
classFilters
- Set of fully-qualified class names- Returns:
- The Request
-