Retrieving Transactions

It is strongly recommended that you use a Callback Listener instead of polling for transaction statuses. The use of polling may consume unnecessary resources on both your end, and on the ValidSign service.

Retrieving Transactions

Retrieving Transaction Within Specified Date Ranges

The first step in retrieving a list of transactions that fall within a specified date range is to define the range of dates. 

GET /api/packages?query={status}&from={from}&to={to}&lastUpdatedStartDate={lastUpdatedStartDate}&lastUpdatedEndDate={lastUpdatedEndDate}
Date START_DATE = new LocalDateTime(2021, 1, 1, 0, 0).toDate();
Date END_DATE = LocalDateTime.now().toDate();

Page draftPage = eslClient.getPackageService().getUpdatedPackagesWithinDateRange(PackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE);
DateTime START_DATE = DateTime.Now.AddDays(-100); 
DateTime END_DATE = DateTime.Now;

Page draftPage = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE);
Retrieving a List of Transactions IDs

To retrieve a list of transaction IDs you can use the following example code below.

GET /api/packages?query={status}&from={from}&to={to}&lastUpdatedStartDate={lastUpdatedStartDate}&lastUpdatedEndDate={lastUpdatedEndDate}&fields=id
PageRequest pageRequest = new PageRequest(1, 100);

Boolean hasNext = false;

do {
    Page> packages = eslClient.getPackageService().getPackagesFields(PackageStatus.COMPLETED, pageRequest, Sets.newHashSet("id"));

    hasNext = packages.hasNextPage();
    pageRequest = pageRequest.next();
     
    List> results = packages.getResults();
    for (Map map : results) {
        String packageId = map.get("id");
        System.out.println(packageId);
    }
     
} while (hasNext);
PageRequest pageRequest = new PageRequest(1, 100);

bool hasNext = false;

do
{
    Page> packages = eslClient.PackageService.GetPackagesFields(DocumentPackageStatus.COMPLETED, pageRequest, new HashSet() { "id" });

    hasNext = packages.HasNextPage();
    pageRequest = pageRequest.Next;
    IList> results = packages.Results;
    foreach (var map in results)
    {
        String packageId = map["id"];
        Debug.WriteLine(packageId);
    }
} while (hasNext);