Search the archive
The REST interface uses a simple HTTP-based REST protocol, using HTTP GET for downloads and searches, PUT for uploads, POST for updates and DELETE for deletion. Here, we will use a GET call to search an archive for documents based on the documentType and documentDate indexes. For further explanation of metadata and indexes, go to Overview.
Construct the search URL
The search is performed by making a GET call using HTTPS to an URL created by appending /metadata to the base URL constructed in Step 1. Append the search parameters as GET parameters, using the index names as parameter names. A username and tracking code should also be added. These can technically be omitted, but should be provided in most situations. The username is attached to the operation in the event log, while the tracking code is used to trace the call when debugging calls. Finally, the parameter format is added to specify if the result should be returned in json or xml formats.
This demonstrates how a search URL can be constructed from field values:
// given the values
int documentType=10002;
String documentDate="20170505"; // (dates are always provided in the YYYYMMDD format)
String userId="charles";
String trackingcode="1000000024";
// the search URL would be
String searchURL = "https://arkiv-test.nets.no/arkiv-rest-generic/external/912341234/eArchive/documents/metadata?documentType=10002&documentDate=20170505&_userId=charles&_trackingCode=1000000024";
Result
This URL will then return an XML with the metadata for all documents in the archive meeting the search criteria. Note that there is a max limit on the number of matched document.
For more information and example output, see Find and download a document.