URL Service
UrlService provides methods to generate URLs to locations in Vault. You can create direct links to:
- The record details page for an object record
- An object record list page
- A document or document version
- A Custom Page, with optional subpaths and query parameters
You can also generate multiple URLs of the same type in an optimized batch request.
Learn more about navigating between Custom Pages and generated URLs in the Custom Pages documentation.
The following example creates a request for a single document URL and a batch request for the same URL, and then logs the URL:
// Build a request for a single Document URL
DocumentUrlRequest docUrlRequest = urlService.newDocumentUrlRequestBuilder()
.withDocumentId(12345L) // Example Document ID
.withVersion(1, 0) // Example Version 1.0
.build();
// Create a batch request for this single document URL
BatchDocumentUrlsRequest batchDocRequest = urlService.newBatchDocumentUrlsRequestBuilder()
.withRequests(Collections.singletonList(docUrlRequest))
.build();
// Get the document URL(s)
BatchUrlsResponse<DocumentUrlResponse> documentUrlsResponse =
urlService.batchGetDocumentUrls(batchDocRequest);
documentUrlsResponse.getResultStream().forEach(response ->
logService.info("Document URL: " + response.getUrl())
);Learn more in the Javadocs