Archive¶
The archive contains all applications that have been archived and on which a final assessment decision has been made.
The archive can list individual documents, based on a search query. Since the archive may contain a lot of documents, results are generally paginated if the underlying system supports it.
See also
Querying Containers for details of how the archive can also be represented as a list of applications.
Note
In order to access the archive, a user must have administrator or archive privileges.
This example shows how to retrieve the content of the archive from the TrustID Cloud:
Request
POST {{server}}/VPE/dataAccess/advancedQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "..."
}
For endpoint details, see /dataAccess/advancedQuery/.
Response
{
"Success": true,
"Message": "Operation executed successfully.",
"Documents": [
...
],
"Page": 0,
"PageSize": 250,
"PaginationSupported": false,
"TotalPages": 1,
"TotalRecords": 12,
"TotalRecordsMatched": 12
}
The TrustID Cloud responds by providing a list of documents that match the archive query. By default, all archived documents are returned. The result might be paginated and information about the current page and page size are provided in the following result properties:
The page number requested (starting with 0).
The number of records per page.
ArchiveQueryResponse.PaginationSupported
true
if pagination is supported. If this isfalse
then only the first page is returned.
ArchiveQueryResponse.TotalPages
The total number of pages.
ArchiveQueryResponse.TotalRecords
The total number of records in the system.
ArchiveQueryResponse.TotalRecordsMatched
The total number of records that matched all the filters provided.
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive();
}).then(function(archive) {
console.log('Current Page:', archive.Page);
console.log('Page Size:', archive.PageSize);
console.log('TotalPages:', archive.TotalPages);
console.log('TotalRecords:', archive.TotalRecords);
console.log('TotalRecordsMatched:', archive.TotalRecordsMatched);
console.log('Archived Documents:', archive);
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
The TrustID Cloud responds by providing a list of documents that match the archive query. For details, see Api.queryArchive.
Quick Query Filter¶
Instead of returning all documents within the archive, query arguments can be used to filter documents.
The following example uses a general filter which is applied to all common document properties, such as name-related fields and/or document number.
Request
POST {{server}}/VPE/dataAccess/advancedQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
"Arguments": {
"QuickQuery": "Banderas"
}
}
For endpoint details, see /dataAccess/advancedQuery/.
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive({
'QuickQuery': 'Banderas'
});
}).then(function(archive) {
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
For details, see Api.queryArchive.
Note
The filter is generally case-insensitive and yields all resulting documents where the filter criteria are contained within specific document properties.
See also
Additional Filters for more information on the available query properties.
Date Range Filter¶
Query results can be filtered by date range as shown below, based on the date when a document was scanned or created:
Request
POST {{server}}/VPE/dataAccess/advancedQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
"RangeFrom": "/Date(...)/",
"RangeUntil": "/Date(...)/"
}
For endpoint details, see /dataAccess/advancedQuery/.
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive(
{},
ModelBase.encodeDate('2017-08-01'), // from
ModelBase.encodeDate('2017-08-31') // until
);
}).then(function(archive) {
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
The helper method ModelBase.encodeDate()
converts a string representation or Date
object into the required JSON representation. For details, see Api.queryArchive.
Note
When using a range-based filter, one (or both) of the date boundaries can be omitted in order to search only for documents that meet one boundary condition.
Operator Filter¶
Results can be filtered on the basis of the operator who originally scanned or created a document. Set the ScannedBy
query argument to the operator’s username, as shown below:
Request
POST {{server}}/VPE/dataAccess/advancedQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
"Arguments": {
"ScannedBy": "admin"
}
}
For endpoint details, see /dataAccess/advancedQuery/.
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive({
ScannedBy: 'username',
});
}).then(function(archive) {
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
For details, see Api.queryArchive.
You can list all available usernames of all operators of the system, as shown below:
Request
POST {{server}}/VPE/dataAccess/queryUsers/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
}
For endpoint details, see /dataAccess/advancedQuery/.
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// get usernames
return api.getUsers();
}).then(function(usernames) {
console.log('usernames:', usernames);
});
For details, see Api.getUsers.
Additional Filters¶
The TrustID Cloud provides a number of additional filter options that are outside of the scope of this documentation. However, the following list of additional filter properties provides a starting point for implementing additional filter criteria.
Each filter property can be specified as follows:
Raw API - as part of the
Arguments
property of the /dataAccess/advancedQuery/ endpoint.Javascript API - as part of the first argument to Api.queryArchive.
Property |
Filters documents based on: |
---|---|
|
Document status (operator or auditor status). |
|
The Machine-Readable Zone (MRZ). |
|
Whether audited (or not). |
|
Whether the MRZ has been corrected manually. |
|
Whether minimum age validation failed. |
|
Whether maximum age validation failed. |
|
First name. |
|
Middle name(s). |
|
Last name(s). |
|
Document holder’s nationality. |
|
Document’s issuing country. |
|
Personal number. |
|
Document holder’s gender. |
|
Document number. |
|
Visa number. |
|
Document type (e.g. Passport, Visa etc). |
|
Branch. |
|
Operator who audited a document. |
|
Expiry date of the document. |
|
Declares how the expiry date filter is matched. |
|
Date of birth of the document holder. |
|
Declares how the |
|
Document-level custom fields. |
Result Sorting¶
Results can be sorted by individual columns as shown below:
Request
POST {{server}}/VPE/dataAccess/queryUsers/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
"DocumentSortingColumn": "ScanDate",
"SortingDirection": "Descending"
}
The properties DocumentSortingColumn and SortingDirection control the column and the sorting direction
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive(
{}, // query arguments
null, null, // date range
0, 25, // page and page size
DocumentSortingColumn.ApplicantName,
SortingDirection.Ascending
);
}).then(function(archive) {
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
The last two arguments of the Api.queryArchive method control the column and the sorting direction.
The result can be sorted by the following columns:
Sorting column |
Value |
Sort by: |
---|---|---|
|
Applicant name. |
|
|
Document type. |
|
|
Scanned/created date. |
Sorting column |
Sort by: |
---|---|
Applicant name. |
|
Document type. |
|
Scanned/created date. |
The result can be sorted in ascending or descending order:
Sorting Direction |
Value |
Sort by: |
---|---|---|
|
Ascending order. |
|
|
Descending order (reversed). |
See the /dataAccess/advancedQuery/ endpoint reference.
Sorting Direction |
Sort by: |
---|---|
Ascending order. |
|
Descending order (reversed). |
Query Pagination¶
The archive may contain a lot of documents (depending on your specific requirements), which is why the TrustID Cloud returns a paginated result if possible.
When a result is requested, only a certain subset of the entire dataset is
returned. By default, the first page (0
) is returned. The maximum page size
is 250
records, which is the default if PageSize
is omitted.
The current page and the requested page size can be specified as arguments to
the request message as shown below. Below we requested the second page (page 1
),
based on a page size of 30
records per page.
Request
POST {{server}}/VPE/dataAccess/advancedQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "...",
"Page": 1,
"PageSize": 30
}
For endpoint details, see /dataAccess/advancedQuery/.
The current page and the requested page size can be specified as arguments to the Api.queryArchive method as shown here:
var api = new TVS.Api();
api.login('username', 'password').then(function() {
// query archive
return api.queryArchive({}, null, null, 1, 30);
}).then(function(archive) {
console.log('Current Page:', archive.Page);
console.log('Page Size:', archive.PageSize);
console.log('TotalPages:', archive.TotalPages);
console.log('TotalRecords:', archive.TotalRecords);
console.log('TotalRecordsMatched:', archive.TotalRecordsMatched);
for (var i = 0; i < archive.Documents.length; i++) {
console.log(
i, ':',
archive.Documents[i].getDocumentTypeDisplay(),
archive.Documents[i].getFullname(),
archive.Documents[i].getStatusDisplay()
);
}
});
The response contains the following useful information about the actual page and page size:
The actual page number returned (starting with
0
). This might not be the page number originally specified.
The actual page size used by the system. This might not be the page size originally specified.
ArchiveQueryResponse.TotalPages
The total number of pages in the system, based on the page size used.
Page
The actual page number returned (starting with
0
). This may not be the page number originally specified.
PageSize
The actual page size used by the system. This may not be the page size originally specified.
TotalPages
The total number of pages in the system, based on the page size used.
Note
The system may change the current page and/or page size if the provided values are out of range.
The maximum number of records per page is 250 records.
Pagination Support¶
Some TrustID Cloud installations may not provide pagination, depending on the underlying database used.
If pagination is not supported, the response from the /dataAccess/advancedQuery/
endpoint indicates this using the ArchiveQueryResponse.PaginationSupported
property, which
is true
if pagination is supported, otherwise false
.
If pagination is not supported, the response from Api.queryArchive indicates this fact using
the PaginationSupported
property, which is true
if pagination is supported, otherwise false
.
In addition, the configuration object included in the login response indicates whether pagination is supported, as shown below:
Request
POST {{server}}/VPE/session/login/
Content-Type: application/json
{
"DeviceId": "device-id",
"Username": "admin",
"Password": "********"
}
Response
This includes the configuration data:
{
"Success": true,
"Message": "Operation executed successfully.",
"Configuration": [
{
"Key": "support.pagination",
"Value": "False"
},
],
...
}
var api = new TVS.Api();
api.login('username', 'password').then(function(loginInfo) {
console.log('pagination supported?', loginInfo.Config.supportsPagination());
});
Note
If pagination is not supported the TrustID Cloud always returns the first page, regardless of the provided page argument.
Querying Containers¶
Instead of querying and yielding documents from the archive, entire containers can be searched. Results can be paginated as described above.
The following example shows how applications are queried:
Request
POST {{server}}/VPE/dataAccess/archiveContainerQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "..."
}
See the /dataAccess/archiveContainerQuery/ endpoint reference.
Request
The TrustID Cloud responds with a list of document containers that match the archive query:
{
"Success": true,
"Message": "Operation executed successfully.",
"Containers": [
...
],
"Page": 0,
"PageSize": 250,
"PaginationSupported": false,
"TotalPages": 1,
"TotalRecords": 8,
"TotalRecordsMatched": 8
}
Querying using application-level custom fields¶
When querying against applications, a number of search criteria can be specified against application-level custom fields. This is shown below:
Request
POST {{server}}/VPE/dataAccess/archiveContainerQuery/
Content-Type: application/json
{
"DeviceId": "device-id",
"SessionId": "..."
"FlexibleFieldSearchSpecifications": [{
"__type": "FlexibleFieldSearchIntegerValues:#TT.Models",
"FlexibleFieldName": "jobApplicationId",
"IntExactMatchList": ["4088", "4089", "3790"]
},
{
"__type": "FlexibleFieldSearchStringValues:#TT.Models",
"FlexibleFieldName": "departmentName",
"StringExactMatchList": ["IT", "HR"]
}]
}
Here the /dataAccess/archiveContainerQuery/ endpoint is used to search against application-level custom fields.
See also
FlexibleFieldSearchSpecification for more information about how to specify different search criteria.