Retrieve Packages Within Date Ranges

The following guide shows you how to retrieve packages with a range of dates.

OneSpan Sign allows you to retrieve the latest version of your packages (transaction in the new UI) within a date range.

The Code

The first step is to define your date range.

Date START_DATE = new LocalDateTime(2016, 1, 1, 0, 0).toDate(); //January 01 2016, 00:00 EST
Date END_DATE = LocalDateTime.now().toDate();

Then, you can retrieve your packages within a date range by status (i.e. COMPLETED, DRAFT, ARCHIVED, SENT, and DECLINED), which are returned to you as a Page from OneSpan Sign.

Page<DocumentPackage> draftPage = eslClient.getPackageService().getUpdatedPackagesWithinDateRange(PackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE);

Get the Code

OneSpan Sign allows you to retrieve the latest version of your packages (transaction in the new UI) within a date range.

The Code

The first step is to define your date range.

DateTime START_DATE = DateTime.Now.AddDays(-100); //Retrieve packages for last 100 days
DateTime END_DATE = DateTime.Now;

Then, you can retrieve your packages within a date range by status (i.e. COMPLETED, DRAFT, ARCHIVED, SENT, and DECLINED), which are returned to you as a Page from OneSpan Sign.

Page<DocumentPackage> draftPage = eslClient.PackageService.GetUpdatedPackagesWithinDateRange(DocumentPackageStatus.DRAFT, new PageRequest(1), START_DATE, END_DATE);

Get the Code

OneSpan Sign allows you to retrieve the latest version of your packages (transaction in the new UI) within a date range.

The Code

The first step is to define your date range.

string START_DATE = "2016-01-01";
string END_DATE = "2016-12-31";

Then, retrieving packages within a date range is done by making the following request:

HTTP Request
GET /api/packages?query={status}&from={from}&to={to}&lastUpdatedStartDate={lastUpdatedStartDate}&lastUpdatedEndDate={lastUpdatedEndDate}

HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key

The JSON objects of each package will be returned to you. The following are the possible values for each parameter:

Response Payload

{
    "results": [
        {
            "roles": [
                {
                    "id": "146e35f4-2474-4c50-822a-cb0fa2d514ce",
                    "data": null,
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "type": "SIGNER",
                    "index": 0,
                    "signers": [
                        {
                            "group": null,
                            "language": "en",
                            "signature": null,
                            "id": "521d3e67-6776-4334-93ab-4e3c8e7410af",
                            "delivery": {
                                "provider": false,
                                "email": false,
                                "download": false
                            },
                            "knowledgeBasedAuthentication": null,
                            "auth": {
                                "scheme": "CHALLENGE",
                                "challenges": [
                                    {
                                        "answer": "golf",
                                        "question": "What's your favorite sport?",
                                        "maskInput": false
                                    }
                                ]
                            },
                            "data": null,
                            "title": "",
                            "external": null,
                            "updated": "2017-11-17T16:44:59Z",
                            "phone": "",
                            "professionalIdentityFields": [],
                            "userCustomFields": [],
                            "company": "",
                            "email": "mail22@mailinator.com",
                            "firstName": "Patty",
                            "lastName": "Galant",
                            "name": "",
                            "address": null,
                            "created": "2017-11-17T16:45:00Z",
                            "specialTypes": []
                        }
                    ],
                    "name": "Signer1"
                },
                {
                    "id": "1zOKlSu9Y0cL",
                    "data": null,
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "type": "SENDER",
                    "index": 0,
                    "signers": [
                        {
                            "group": null,
                            "language": "en",
                            "signature": {
                                "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
                                "textual": null
                            },
                            "id": "ZQI8k6faVoM8",
                            "delivery": {
                                "provider": false,
                                "email": true,
                                "download": true
                            },
                            "knowledgeBasedAuthentication": null,
                            "auth": {
                                "scheme": "NONE",
                                "challenges": []
                            },
                            "data": null,
                            "title": null,
                            "external": null,
                            "updated": "2017-11-17T16:44:54Z",
                            "phone": "",
                            "professionalIdentityFields": [],
                            "userCustomFields": [],
                            "company": "OneSpan Sign",
                            "email": "harishaidary@mailinator.com",
                            "firstName": "Haris",
                            "lastName": "Haidary",
                            "name": "",
                            "address": null,
                            "created": "2017-11-17T16:44:55Z",
                            "specialTypes": []
                        }
                    ],
                    "name": "Owner"
                },
                {
                    "id": "945d1910-1de6-4536-867f-c86f20acda7e",
                    "data": null,
                    "emailMessage": null,
                    "attachmentRequirements": [],
                    "locked": false,
                    "reassign": false,
                    "specialTypes": [],
                    "type": "SIGNER",
                    "index": 0,
                    "signers": [
                        {
                            "group": null,
                            "language": "en",
                            "signature": null,
                            "id": "18d6f1b8-13b3-4340-a174-edfe440c93f7",
                            "delivery": {
                                "provider": false,
                                "email": false,
                                "download": false
                            },
                            "knowledgeBasedAuthentication": null,
                            "auth": {
                                "scheme": "SMS",
                                "challenges": [
                                    {
                                        "answer": null,
                                        "question": "+15515584587",
                                        "maskInput": false
                                    }
                                ]
                            },
                            "data": null,
                            "title": "",
                            "external": null,
                            "updated": "2017-11-17T16:45:04Z",
                            "phone": "",
                            "professionalIdentityFields": [],
                            "userCustomFields": [],
                            "company": "",
                            "email": "mail11@mailinator.com",
                            "firstName": "John",
                            "lastName": "Smith",
                            "name": "",
                            "address": null,
                            "created": "2017-11-17T16:45:04Z",
                            "specialTypes": []
                        }
                    ],
                    "name": "Signer2"
                }
            ],
            "status": "DRAFT",
            "description": "",
            "language": "en",
            "id": "mC3p1FENigGItiL3Zmojtr64e0Y=",
            "data": {
                "senderVisible": false,
                "currentSignerProgress": {
                    "documentsToConfirmCount": "0",
                    "documentsConfirmedCount": "0",
                    "approvalsToConfirmCount": "0",
                    "approvalsConfirmedCount": "0",
                    "documentsPartiallyCompletedCount": "0",
                    "approvalsToSignNowCount": "0"
                },
                "overallProgress": {
                    "documentsToCompleteCount": "0",
                    "documentsCompletedCount": "0",
                    "documentsToConfirmCount": "0",
                    "documentsConfirmedCount": "0",
                    "documentsPartiallyCompletedCount": "0"
                }
            },
            "autocomplete": true,
            "documents": [],
            "sender": {
                "status": "ACTIVE",
                "language": "en",
                "signature": {
                    "handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
                    "textual": null
                },
                "id": "ZQI8k6faVoM8",
                "data": {
                    "serviceCredentials": "{}",
                    "showIntro": false
                },
                "account": null,
                "title": null,
                "external": null,
                "updated": "2016-05-05T19:30:13Z",
                "memberships": [],
                "phone": "+1 201-555-5555",
                "professionalIdentityFields": [],
                "userCustomFields": [
                    {
                        "id": "policy_number_id",
                        "data": null,
                        "translations": [
                            {
                                "description": "Car Insurance Policy Number.",
                                "language": "en",
                                "id": "",
                                "data": null,
                                "name": "Policy Number"
                            }
                        ],
                        "value": "",
                        "name": ""
                    }
                ],
                "locked": null,
                "activated": null,
                "company": "OneSpan Sign",
                "email": "harishaidary@mailinator.com",
                "firstName": "Haris",
                "lastName": "Haidary",
                "type": "MANAGER",
                "name": "",
                "address": null,
                "created": "2016-05-05T19:30:13Z",
                "specialTypes": [],
                "hasDelegates": false
            },
            "emailMessage": "",
            "limits": null,
            "notarized": false,
            "notaryRoleId": null,
            "settings": {
                "ceremony": {
                    "layout": {
                        "header": {
                            "feedback": true,
                            "titleBar": null,
                            "breadcrumbs": true,
                            "globalActions": {
                                "confirm": true,
                                "download": true,
                                "hideEvidenceSummary": true,
                                "saveAsLayout": true
                            },
                            "globalNavigation": true,
                            "sessionBar": true
                        },
                        "footer": null,
                        "brandingBar": {
                            "logo": {
                                "link": "",
                                "src": "branding"
                            }
                        },
                        "iframe": false,
                        "navigator": true
                    },
                    "style": null,
                    "enforceCaptureSignature": false,
                    "events": {
                        "complete": {
                            "redirect": null,
                            "dialog": true
                        }
                    },
                    "extractAcroFields": true,
                    "extractTextTags": true,
                    "inPerson": false,
                    "declineButton": true,
                    "declineReasons": [],
                    "disableDeclineOther": false,
                    "disableDownloadForUncompletedPackage": false,
                    "disableFirstInPersonAffidavit": false,
                    "disableInPersonAffidavit": false,
                    "disableOptOutOther": false,
                    "disableSecondInPersonAffidavit": false,
                    "documentToolbarOptions": null,
                    "handOver": null,
                    "hideCaptureText": false,
                    "hideLanguageDropdown": false,
                    "hidePackageOwnerInPerson": false,
                    "hideWatermark": false,
                    "maxAuthFailsAllowed": 3,
                    "optOutButton": true,
                    "optOutReasons": []
                }
            },
            "signedDocumentDelivery": null,
            "trashed": false,
            "updated": "2017-11-17T16:49:16Z",
            "completed": null,
            "consent": null,
            "due": null,
            "visibility": "ACCOUNT",
            "type": "PACKAGE",
            "messages": [],
            "name": "test",
            "created": "2017-11-17T16:44:55Z",
            "bulkSendable": false
        }
    ],
    "count": 20
}

query: ARCHIVED, COMPLETED, DRAFT, SENT, EXPIRED, OPTED_OUT, AND DECLINED.
from: Specify the number of packages returned for the purposes of pagination. Note: A maximum of 100 packages can be returned.
to: Specify the number of packages returned for the purposes of pagination. Note: A maximum of 100 packages can be returned.
lastUpdatedStartDate: The date after which the package must have been last updated to be retrieved (e.g. 2016-01-01).
lastUpdatedEndDate: The date before which the package must have been last updated to be retrieved (e.g. 2016-12-31).

Get the Code

OneSpan Sign allows you to retrieve the latest version of your packages (transaction in the new UI) within a date range.
To notice, some of the code is an extension of the APEX SDK and can be gotten through this Code Share.

The Code

The function is encapsulated like below. You can retrieve a list of packages by passing in a map of query parameters.

public List<ESignLiveAPIObjects.Package_x> getPackages(Map<String,String> queryParameters)

Below code snippet shows you a sample usage:

List<ESignLiveAPIObjects.Package_x> packages = new TestRetrievePackagesWithinDateRanges().getPackages(new Map<String,String>{'lastUpdatedStartDate'=>'2018-11-01','lastUpdatedEndDate'=>'2018-11-10','from'=>'1','to'=>'100','query'=>'SENT'});

query (optional): ARCHIVED, COMPLETED, DRAFT, SENT, EXPIRED, OPTED_OUT, AND DECLINED.
Note: The keyword specifying package status is “query” instead of “status”.
from&to (required): Specify the number of packages returned for the purposes of pagination.
Note: Index starts from 1, and a maximum of 100 packages can be returned. Use from=1&to=100, from=101&to=200, and so on.
lastUpdatedStartDate (optional): The date after which the package must have been last updated to be retrieved (e.g. “2018-01-01”).
lastUpdatedEndDate (optional): The date before which the package must have been last updated to be retrieved (e.g. “2018-12-31”).

Also refer to this Document Page for all potential query parameters.
Get the Code