Following up on creating a document package, this guide will cover how to retrieve, update, archive and delete your document package.

The Code

To retrieve a package, you will first need to create a PackageId object using the id returned to you during package creation. Then, you can retrieve your package using the OneSpan Sign client and passing the PackageId object you just created as a parameter.
PackageId packageId = new PackageId("package_id_here");
DocumentPackage retrievedPkg = eslClient.getPackage(packageId);
You can also retrieve a list of packages/transactions.
Page<DocumentPackage> resultPage = eslClient.getPackageService().getPackages( new PackageStatusConverter(PackageStatus.SENT).toAPIPackageStatus(), new PageRequest(1, 10));
The call above will return the first 10 packages/transactions in status SENT. You can query the following statuses in OneSpan Sign: SENT, DRAFT, COMPLETED, OPTED_OUT, DECLINED, EXPIRED, and ARCHIVED. To update an existing package that is in DRAFT status, simply create a document package object with only the updates you want to make to the package and then simply call the UpdatePackage function with the packageId of the existing package and the updates DocumentPackage:
DocumentPackage packageToUpdate = PackageBuilder.newPackageNamed(NEW_PACKAGE_NAME)
	              .describedAs(NEW_DESCRIPTION)
	              .withEmailMessage(NEW_EMAIL_MESSAGE)
	              .expiresAt(LocalDateTime.now().toDate())
	              .withLanguage(Locale.FRENCH)
	              .withVisibility(NEW_VISIBILITY)
	              .withNotarized(NEW_NOTARIZED)
	              .autocomplete(false)
	              .withSettings(settingsToUpdate)
	              .build();
	
eslClient.updatePackage(packageId, packageToUpdate);
If you want to remove a package from your account, permanently, simply call the deletePackage function with the packageId of the package you wish to delete.
eslClient.getPackageService().deletePackage(packageId);
If you might want to access this package in the future, you can move a package to your trash folder instead.
eslClient.getPackageService().trash(packageId);
Finally, to archive a package, simply call on the OneSpan Sign client with the packageId you wish to archive:
eslClient.getPackageService().archive(new PackageId("packageId"));

Get the Code

Following up on creating a document package, this guide will cover how to retrieve, update, archive and delete your document package.

The Code

To retrieve a package, you will first need to create a PackageId object using the id returned to you during package creation. Then, you can retrieve your package using the OneSpan Sign client and passing the PackageId object you just created as a parameter.
PackageId packageId = new PackageId("package_id_here");
DocumentPackage retrievedPkg = eslClient.GetPackage(packageId);
You can also retrieve a list of packages/transactions.
Page<DocumentPackage> packages = eslClient.PackageService.GetPackages (DocumentPackageStatus.SENT, new PageRequest(1, 10));
The call above will return the first 10 packages/transactions in status SENT. You can query the following statuses in OneSpan Sign: SENT, DRAFT, COMPLETED, OPTED_OUT, DECLINED, EXPIRED, and ARCHIVED. To update an existing package that is in DRAFT status, simply create a document package object with only the updates you want to make to the package and then simply call the UpdatePackage function with the packageId of the existing package and the updates DocumentPackage:
DocumentPackage packageToUpdate = PackageBuilder.NewPackageNamed(NEW_PACKAGE_NAME)
                                .WithEmailMessage(NEW_EMAIL_MESSAGE)
                                .ExpiresOn(NEW_EXPIRY_DATE)
                                .WithLanguage(NEW_LANGUAGE)
                                .WithVisibility(NEW_VISIBILITY)
                                .WithNotarized(NEW_NOTARIZED)
                                .WithoutAutomaticCompletion()
                                .WithSettings(settingsToUpdate)
                                .Build();
eslClient.UpdatePackage(packageId, packageToUpdate);
If you want to remove a package from your account, permanently, simply call the DeletePackage function with the packageId of the package you wish to delete.
eslClient.PackageService.DeletePackage(packageId);
If you might want to access this package in the future, you can move a package to your trash folder instead.
eslClient.PackageService.Trash(packageId);
Finally, to archive a package, simply call on the OneSpan Sign client with the packageId you wish to archive:
eslClient.PackageService.Archive(new PackageId("packageId"));

Get the Code

Following up on creating a document package, this guide will cover how to retrieve, update, archive and delete your document package.

The Code

To retrieve a package (GET), update (PUT), or delete a package (DELETE), you will need to make your request to the following URL using the id returned to you during package creation:
{instance_url}/api/packages/{packageId}
You can also retrieve a list of packages/transactions.

HTTP Request

GET /api/packages?from=1&to=5&query=SENT

HTTP Headers

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

For all optional query parameters, refer to this API documentation.

Response Payload

{
  "results": [
    {...},
    {...},
    {...},
    {...},
    {...}
  ],
  "count": 30
}

For a complete description of each field, take a look at the Request Payload section below.

The call above will return the first 5 packages/transactions in status SENT out of the total count 30. You can query the following statuses in OneSpan Sign: SENT, DRAFT, COMPLETED, OPTED_OUT, DECLINED, EXPIRED, and ARCHIVED. To update an existing package that is in DRAFT status, simply create a payload with only the updates you want to make to the package and make your PUT request:

HTTP Request

PUT /api/packages/{packageId}

HTTP Headers

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

Request Payload

{
  "due": "2017-02-13T21:18:40Z",
  "emailMessage": "new email message",
  "notarized": true,
  "settings": {...},
  "description": "",
  "autocomplete": false,
  "visibility": "ACCOUNT",
  "status": "DRAFT",
  "type": "PACKAGE",
  "roles": [
    {
      "reassign": false,
      "locked": false,
      "index": 0,
      "type": "SENDER",
      "signers": [
        {
          "title": null,
          "address": null,
          "phone": "",
          "firstName": "Haris",
          "lastName": "Haidary",
          "email": "[email protected]",
          "company": "Onespan",
          "language": "fr",
          "name": ""
        }
      ],
      "name": "Owner"
    }
  ],
  "language": "fr",
  "name": "new package name",
  "bulkSendable": false
}
If you want to remove a package from your account, permanently, simply make a DELETE request. If on the other hand, you might want to access this package in the future, you can move a package to your trash folder instead by making a PUT request with the following payload:

HTTP Request

PUT /api/packages/{packageId}

HTTP Headers

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

Request Payload

{
  "trashed": true
}
Finally, to archive a package, simply update the status of the package to ARCHIVED:

HTTP Request

PUT /api/packages/{packageId}

HTTP Headers

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

Request Payload

{
  "status": "ARCHIVED"
}

Get the Code

Request Payload

PropertyTypeEditableRequiredDefaultSample Value(s)
statusstringYesNoDRAFTDRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED
duestringYesYesnull2017-02-13T21:18:40Z
emailMessagestringYesYesnullnew email message
notarizedbooleanYesYesfalsetrue / false
descriptionstringYesYesnullSample transaction from STU BANK
autoCompletebooleanYesNotruetrue / false
typestringYesNoPACKAGEPACKAGE / TEMPLATE / LAYOUT
namestringYesYesn/aDocument Attributes Example
trashedbooleanYesNofalsetrue / false
languagestringYesYesenen / fr / es ...
visibilitystringYesNoACCOUNTACCOUNT / SENDER
bulkSendablebooleanYesNofalsefalse / true
roles
idstringYesNon/aClient1
indexintegerYesNo00 / 1 / 2 ...
reassignbooleanYesNofalsefalse / true
lockedbooleanYesNofalsefalse / true
namestringYesNon/aClient1
typestringYesNoSIGNERSIGNER / SENDER
signers
emailstringYesYesn/a[email protected]
firstNamestringYesYesn/aJohn
lastNamestringYesYesn/aSmith
phonestringYesNon/a514-555-8888
idstringYesNon/aClient1
companystringYesNon/aAcme Inc.
addressstringYesNon/a123 Main St.
titlestringYesNon/aManaging Director
settings
ceremony
inPersonbooleanYesNofalsefalse / true
declineButtonbooleanYesNotruefalse / true
declineReasonsstringYesNon/anew decline reason #1
optOutReasonsstringYesNon/anew opt-out reason #1
disableDeclineOtherbooleanYesNofalsefalse / true
disableDownloadForUncompletedPackagebooleanYesNofalsefalse / true
disableFirstInPersonAffidavitbooleanYesNofalsefalse / true
disableInPersonAffidavitbooleanYesNofalsefalse / true
disableOptOutOtherbooleanYesNofalsefalse / true
disableSecondInPersonAffidavitbooleanYesNofalsefalse / true
hideCaptureTextbooleanYesNofalsefalse / true
hideLanguageDropdownbooleanYesNofalsefalse / true
hidePackageOwnerInPersonbooleanYesNofalsefalse / true
hideWatermarkbooleanYesNofalsefalse / true
maxAuthFailsAllowedintegerYesNo31 / 2 / 3 ...
optOutButtonbooleanYesNofalsefalse / true
layout
iframebooleanYesNofalsefalse / true
navigatorbooleanYesNofalsefalse / true
header
feedbackbooleanYesNofalsefalse / true
breadcrumbsbooleanYesNofalsefalse / true
globalNavigationbooleanYesNofalsefalse / true
sessionBarbooleanYesNofalsefalse / true
titleBar
progressBarbooleanYesNofalsefalse / true
titleBarbooleanYesNofalsefalse / true
globalActions
confirmbooleanYesNofalsefalse / true
downloadbooleanYesNofalsefalse / true
hideEvidenceSummarybooleanYesNofalsefalse / true
saveAsLayoutbooleanYesNofalsefalse / true
brandingBar
logo
srcstringYesNonullnew logo image source
linkstringYesNonullnew logo image link
events
complete
dialogbooleanYesNofalsetrue / false
redirectstringYesNonullhttps://www.google.ca
handOver
hrefstringYesNonullhttp://www.new.ca
titlestringYesNonullnew hand over link tool tip
textstringYesNonullnew hand over link text
Following up on creating a document package, this guide will cover how to retrieve, update, archive and delete your document package. To notice, some of the code is an extension of the APEX SDK and can be gotten through this Code Share.

The Code

To retrieve a package, you can call below function by passing the package ID you just created as a parameter.
//retrieve a package
ESignLiveSDK sdk = new ESignLiveSDK();
ESignLiveAPIObjects.Package_x pkg = sdk.getPackage(packageId);
You can also retrieve a list of packages/transactions, this function is encapsulated like below:
public List<ESignLiveAPIObjects.Package_x> getPackages(Map<String,String> queryParameters)
You can pass a map of query parameters in order to narrow your search like this:
List<ESignLiveAPIObjects.Package_x> pkgs = getPackages(new Map<String,String>{'from'=>'0','to'=>'9','status'=>'SENT'});
The call above will return the first 10 packages/transactions in status SENT. You can query the following statuses in OneSpan Sign: SENT, DRAFT, COMPLETED, OPTED_OUT, DECLINED, EXPIRED, and ARCHIVED. Refer to this Document Page for all potential query parameters. To update an existing package that is in DRAFT status, you can either grab the existing package object and do changes on that or simply create a package object with only the updates you want to make to the package, then simply call the updatePackage() function with the package ID of the existing package and the updates Package_x object:
//update package
ESignLiveAPIObjects.Package_x pkg = sdk.getPackage(packageId); //or
ESignLiveAPIObjects.Package_x pkg = new ESignLiveAPIObjects.Package_x();
pkg.name = 'changed package name';
sdk.updatePackage(pkg, packageId);
If you want to remove a package from your account, permanently, simply call the deletePackage () function with the package ID of the package you wish to delete.
//delete package
sdk.deletePackage(packageId); 
If you might want to access this package in the future, you can move a package to your trash folder instead.
//trash package
ESignLiveAPIObjects.Package_x pkg = sdk.getPackage(packageId);
pkg.trashed = true;    
sdk.updatePackage(pkg, packageId);
Finally, to archive a package, simply call setStatus() function with package ID you wish to archive:
//archive package
sdk.setStatus(packageId, ESignLiveAPIObjects.PackageStatus.ARCHIVED);	//you can only archive completed packages
sdk.setStatus(packageId, ESignLiveAPIObjects.PackageStatus.COMPLETED); //restore archive

Get the Code