- 10 Oct 2024
- 31 Minutes to read
- DarkLight
- PDF
Managing Existing Templates
- Updated on 10 Oct 2024
- 31 Minutes to read
- DarkLight
- PDF
Java SDK.NET SDKREST APIAPEX SDK
Java SDK
To download the full code sample see our Code Share site.
Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.
Retrieving a Template
Retrieving templates is done with the OneSpan Sign PackageService(). Templates are returned as a Page object. The following code will retrieve a template:
int i = 1;
ArrayList<String> templateIds = new ArrayList<String>();
Page<DocumentPackage> templates = eslClient.getPackageService().getTemplates(new PageRequest(i ,50));
for (DocumentPackage template : templates) {
System.out.println(String.format("Template name: %s with id %s", template.getName(), template.getId()));
templateIds.add(template.getId().toString());
}
Updating a Template
To update a template, first create a new PackageId object using the Template ID. Then, retrieve your template using this PackageId object and change your settings as required. Once you have finished, use the TemplateService() to update your template. The following code will do this:
PackageId templateId = new PackageId(templateIds.get(0));
DocumentPackage templateToUpdate = eslClient.getPackage(templateId);
templateToUpdate.setName("This template has been updated");
eslClient.getTemplateService().updateTemplate(templateToUpdate);
Deleting a Template
To delete a template, use the PackageService(). The following code will do this:
eslClient.getPackageService().deletePackage(templateId);
.NET SDK
To download the full code sample see our Code Share site.
Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.
The Code
Retrieving templates is done with the OneSpan Sign PackageService(). Templates are returned as a Page object. The following code will retrieve a template:
int i = 1;
ArrayList templateIds = new ArrayList();
Page<DocumentPackage> templates = eslClient.PackageService.GetTemplates(new PageRequest(i, 50));
foreach (DocumentPackage template in templates)
{
Debug.WriteLine(string.Format("Template name: {0} with id {1}", template.Name, template.Id));
templateIds.Add(template.Id.ToString());
}
Updating a Template
To update a template, first create a new PackageId object using the Template ID. Then, retrieve your template using this PackageId object and change your settings as required. Once you have finished, use the TemplateService() to update your template. The following code will do this:
PackageId templateId = new PackageId(templateIds[0].ToString());
DocumentPackage templateToUpdate = eslClient.GetPackage(templateId);
templateToUpdate.Name = "This template has been updated";
eslClient.TemplateService.Update(templateToUpdate);
Deleting a Template
To delete a template, use the PackageService(). The following code will do this:
eslClient.PackageService.DeletePackage(templateId);
REST API
To download the full code sample see our Code Share site.
Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.
Retrieving a Template
The following code will retrieve a template:
HTTP Request
GET /api/packages?type=TEMPLATE&from=0&to=100
HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key
Response Payload
{
"results": [
{
"roles": [
{
"id": "a32f8b14-2771-4000-9ab6-19b8e9aae4bc",
"emailMessage": null,
"attachmentRequirements": [],
"locked": false,
"reassign": false,
"specialTypes": [],
"data": null,
"index": 2,
"type": "SIGNER",
"signers": [],
"name": "Placeholder2"
},
{
"id": "fad2c2d5-d75c-4bac-8707-3d9a555b8a07",
"emailMessage": null,
"attachmentRequirements": [],
"locked": false,
"reassign": false,
"specialTypes": [],
"data": null,
"index": 1,
"type": "SIGNER",
"signers": [],
"name": "Placeholder1"
},
{
"id": "YV68HNuhshUS",
"emailMessage": null,
"attachmentRequirements": [],
"locked": false,
"reassign": false,
"specialTypes": [],
"data": null,
"index": 0,
"type": "SENDER",
"signers": [
{
"group": null,
"language": "en",
"signature": {
"handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
"textual": null
},
"id": "ZQI8k6faVoM8",
"address": null,
"created": "2017-11-01T14:54:52Z",
"title": null,
"external": null,
"updated": "2017-11-01T14:54:52Z",
"phone": "",
"userCustomFields": [],
"company": "eSignLive",
"email": "haris.haidary@gmail.com",
"firstName": "Haris",
"lastName": "Haidary",
"professionalIdentityFields": [],
"data": null,
"auth": {
"scheme": "NONE",
"challenges": []
},
"knowledgeBasedAuthentication": null,
"delivery": {
"email": true,
"download": true,
"provider": false
},
"name": "",
"specialTypes": []
}
],
"name": "Owner"
}
],
"status": "DRAFT",
"description": "",
"language": "en",
"id": "9VFZTf0vgi2rGEGHTozxZAXlm28=","created": "2017-11-01T14:54:52Z",
"autocomplete": true,
"sender": {
"status": "ACTIVE",
"language": "en",
"signature": {
"handdrawn": "AQAAADJI+a4cnf0t3Dlf0GqWJceCA+4AAwADAN8BAAADAAAAggPuAOgAAAACfyxAUkAlQCdAOUA6QDtAHEAtQBtACkAJQBVAFBIyfkA0QBVABkAYQCpAHEAtQC9ALkAtQDxAO0A6QEhAN0AlQCQyTjZAgEBwQIBAoFDSUOFQ8lDiUNJQ0lCiQHBAUCIXGVBSUCVQN1BJUDpQXVA9UE5QLlAuUDpQOVAkm1BhQLZAd0B7QFpAXUBPQTBAHkAdQAtAB2AmYBRgQmCAcJVwmHC5Mh42QFBAkECAQKBAsEDAQNBQ8VDyUPJQ81DTULRQg1ByUEGeIgQ6QDhAJ0AmQCZAFItwbHBtMhdBUCafUGJQcVCSUJFQoUDAQKBAsECBQHNAdEBEQDRABkAFYCdgR2BXYHhgd2CIYIVgdmBDYEJAUUBwQIFAkECwQLBA0EDAQLBAoEBwQGASG0xAc0BnQEhASkArQBxADEAKQAlABkAFMkVKUENQUVBBUGFQYVCRUKJQsVDCUNJQsUDQQKBAkEBwQFJAREAlIllVUHFQUVByUKFQslDSUNJQ9VDlUPZQ1lDWUKVQZVBEUCQyCxivr2BjYGRgdGB1YHZgZmBWYEdgRkAFQClAREBjQJNAk0CzQKNAs0CjQJNAQo9gRWBjYJNgs2DCYNRg1GCkYKRgY2Bkrg==",
"textual": null
},
"id": "ZQI8k6faVoM8",
"address": {
"zipcode": "",
"address1": "",
"address2": "",
"city": "",
"country": "",
"state": ""
},
"created": "2016-05-05T19:30:13Z",
"title": null,
"external": null,
"updated": "2016-05-05T19:30:13Z",
"memberships": [],
"phone": "+1 201-555-5555",
"userCustomFields": [
{
"id": "policy_number_id",
"translations": [
{
"description": "Car Insurance Policy Number.",
"language": "en",
"id": "",
"data": null,
"name": "Policy Number"
}
],
"data": null,
"value": "",
"name": ""
}
],
"locked": null,
"activated": null,
"company": "eSignLive",
"email": "haris.haidary@gmail.com",
"firstName": "Haris",
"lastName": "Haidary",
"professionalIdentityFields": [],
"account": {
"owner": "ZQI8k6faVoM8",
"id": "3vD0Dc9Fh7wQ",
"created": "2016-05-05T19:30:13Z",
"providers": null,
"updated": "2016-05-05T19:30:13Z",
"company": {
"id": "jVWmyg4cyis8",
"address": {
"zipcode": null,
"address1": null,
"address2": null,
"city": null,
"country": null,
"state": null
},
"data": null,
"name": "eSignLive"
},
"customFields": [
{
"required": false,
"id": "policy_number_id",
"translations": [
{
"description": "Car Insurance Policy Number.",
"language": "en",
"id": "",
"data": null,
"name": "Policy Number"
}
],
"data": null,
"value": "123-456-789-0",
"name": ""
}
],
"licenses": [
{
"status": "ACTIVE",
"created": "2016-05-05T19:30:13Z",
"paidUntil": "2020-05-05T00:00:00Z",
"transactions": [],
"plan": {
"group": "",
"description": "E-Sign Hundreds of Documents with Unlimited Signers",
"id": "sandbox",
"features": null,
"cycle": "YEAR",
"contract": "YEAR",
"freeCycles": null,
"quotas": [
{
"scope": "ACCOUNT",
"cycle": null,
"limit": 100,
"target": "SENDER"
},
{
"scope": "SENDER",
"cycle": null,
"limit": 500,
"target": "DOCUMENT"
},
{
"scope": "SENDER",
"cycle": null,
"limit": 500,
"target": "STORAGE"
}
],
"original": null,
"data": null,
"price": {
"amount": 0,
"currency": {
"id": "USD",
"data": null,
"name": "US Dollar"
}
},
"name": "Sandbox"
}
}
],
"logoUrl": "",
"data": null,
"name": "Haris Haidary"
},
"data": {
"serviceCredentials": "{}",
"showIntro": false
},
"type": "MANAGER",
"name": "",
"specialTypes": [],
"hasDelegates": false
},
"documents": [
{
"status": "",
"description": "",
"id": "b1bcf8fb96e7663fcf8d79b3d36ab03a409ffb5ac183ced6",
"approvals": [
{
"role": "a32f8b14-2771-4000-9ab6-19b8e9aae4bc",
"id": "f3L60CQtJ4w4",
"signed": null,
"accepted": null,
"data": null,
"fields": [
{
"binding": null,
"validation": null,
"id": "FT055fW0IMEM",
"page": 0,
"subtype": "FULLNAME",
"height": 52.0252180917263,
"extract": false,
"width": 234.98929138064383,
"extractAnchor": null,
"left": 241.80519113063812,
"top": 605.0225778079033,
"data": null,
"type": "SIGNATURE",
"value": "",
"name": ""
}
],
"name": ""
},
{
"role": "fad2c2d5-d75c-4bac-8707-3d9a555b8a07",
"id": "mEZ3ZWiNBYkE",
"signed": null,
"accepted": null,
"data": null,
"fields": [
{
"binding": null,
"validation": null,
"id": "MGG8WGRTIEoJ",
"page": 0,
"subtype": "FULLNAME",
"height": 51.99999809265137,
"extract": false,
"width": 234.9996913802624,
"extractAnchor": null,
"left": 221.99969185709955,
"top": 514.000481146574,
"data": null,
"type": "SIGNATURE",
"value": "",
"name": ""
}
],
"name": ""
}
],
"pages": [
{
"id": "53659ae7eb53699b0e6027311a5b9db435984e896e1306cf_0_-1_1.png",
"height": 1030,
"left": 0,
"width": 796,
"top": 0,
"index": 0,
"version": 0
}
],
"external": null,
"extract": false,
"data": {},
"signedHash": null,
"extractionTypes": [],
"signerVerificationToken": null,
"fields": [],
"index": 0,
"name": "sample_contract",
"size": 97332
}
],
"consent": null,
"due": null,
"emailMessage": "",
"limits": null,
"notarized": false,
"settings": {
"ceremony": {
"layout": {
"header": {
"feedback": true,
"breadcrumbs": true,
"globalActions": {
"confirm": true,
"download": true,
"hideEvidenceSummary": true,
"saveAsLayout": true
},
"globalNavigation": true,
"titleBar": null,
"sessionBar": true
},
"brandingBar": {
"logo": {
"link": "",
"src": "branding"
}
},
"iframe": false,
"footer": null,
"navigator": true
},
"inPerson": false,
"declineButton": true,
"declineReasons": [],
"disableDeclineOther": false,
"disableDownloadForUncompletedPackage": false,
"disableFirstInPersonAffidavit": false,
"disableInPersonAffidavit": false,
"disableOptOutOther": false,
"disableSecondInPersonAffidavit": false,
"documentToolbarOptions": null,
"events": {
"complete": {
"dialog": true,
"redirect": null
}
},
"handOver": null,
"hideCaptureText": false,
"hideLanguageDropdown": false,
"hidePackageOwnerInPerson": false,
"hideWatermark": false,
"maxAuthFailsAllowed": 3,
"optOutButton": true,
"optOutReasons": [],
"extractAcroFields": false,
"extractTextTags": false,
"style": null,
"enforceCaptureSignature": false
}
},
"signedDocumentDelivery": null,
"updated": "2017-11-01T14:55:35Z",
"visibility": "SENDER",
"data": {
"senderVisible": false
},
"messages": [],
"type": "TEMPLATE",
"name": "Signing Order Sender",
"notaryRoleId": null,
"bulkSendable": true
}
],
"count": 11
}
Updating a Template
To update a template, you first need to retrieve your Template ID. Then, you build your JSON payload with the parameters you wish to modify.
HTTP Request
PUT /api/packages/{templateId}
HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key
Request Payload
{
"name": "Updating template name"
}
For a complete description of each field, see the Request Payload table below.
Deleting a Template
Finally, to delete a template, make a DELETE request, as follows:
HTTP Request
DELETE /api/packages/{templateId}
HTTP Headers
Accept: application/json
Content-Type: application/json
Authorization: Basic api_key
Request Payload Table
Property | Type | Editable | Required | Default | Sample Values |
---|---|---|---|---|---|
status | string | Yes | No | DRAFT | DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED |
autoComplete | boolean | Yes | No | true | true / false |
type | string | Yes | No | PACKAGE | PACKAGE / TEMPLATE / LAYOUT |
name | string | Yes | Yes | n/a | Document Attributes Example |
trashed | boolean | Yes | No | false | true / false |
visibility | string | Yes | No | ACCOUNT | ACCOUNT / SENDER |
documents | |||||
name | string | Yes | No | n/a | sample doc |
approvals | |||||
fields | |||||
subtype | string | Yes | No | n/a | FULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST |
type | string | Yes | No | n/a | SIGNATURE / INPUT |
extract | boolean | Yes | No | false | true / false |
height | integer | Yes | No | 50 | 50 / 100 / 150 ... |
left | integer | Yes | No | 0 | 50 / 100 / 150 ... |
page | integer | Yes | No | 0 | 0 / 1 / 2 ... |
top | integer | Yes | No | 0 | 50 / 100 / 150 ... |
width | integer | Yes | No | 200 | 50 / 100 / 150 ... |
role | string | Yes | No | n/a | Client1 |
data | |||||
Department | string | Yes | No | n/a | 1806 |
Employee | string | Yes | No | n/a | 135526 |
roles | |||||
id | string | Yes | No | n/a | Client1 |
name | string | Yes | No | n/a | Client1 |
type | string | Yes | No | SIGNER | SIGNER / SENDER |
signers | |||||
string | Yes | Yes | n/a | preparer.email@example.com | |
firstName | string | Yes | Yes | n/a | John |
lastName | string | Yes | Yes | n/a | Smith |
phone | string | Yes | No | n/a | 514-555-8888 |
id | string | Yes | No | n/a | Client1 |
company | string | Yes | No | n/a | Acme Inc. |
title | string | Yes | No | n/a | Managing Director |
APEX SDK
To download the full code sample see our Code Share site.
Templates and Layouts fulfill the same goal of automating the e-signature process by shortening the time it takes to send documents that include several signature blocks and data fields. Templates are ideal to use at the transaction level – you can pre-define your signers, documents, signature locations and e-signature workflows to streamline the e-signature process. A Layout on the other hand, is a type of template that allows you to create pre-defined locations for your signature blocks and data fields within a document. It acts like a ‘marker’ where signature blocks and data fields will sit in the document. Layouts are helpful for users who frequently send forms that may be slightly different per recipient but signature blocks and data fields remain in the same location throughout the document. What’s more, you can use multiple Layouts per document, and apply them to individual pages within your transaction.
Retrieving a Template
The following code will retrieve a template:
//Retrieving templates
integer totalCount = getTemplateCount();
integer index = 1;
List<ESignLiveAPIObjects.package_x> templates = new List<ESignLiveAPIObjects.package_x>();
System.debug('Total template count: ' + totalCount);
while(index < totalCount){
templates.addAll(getTemplates(index,index+49));
index += 50;
}
for(ESignLiveAPIObjects.package_x template: templates){
System.debug('Template name: ' + template.name + ' with id: ' + template.id);
}
In the code above, there are two encapsulated functions:
public integer getTemplateCount(): This returns the total amount of templates.
public List<ESignLiveAPIObjects.package_x> getTemplates(integer from_x, integer to): This returns a list of template objects according to from and to index. The Index starts at 1 and returns a maximum of 100 results.
Updating a Template
To update a template, you first need to retrieve your template using the Template ID. Then, change your settings as required. Once you have finished, use the updatePackage () to update your template. The following code will do this:
ESignLiveSDK sdk = new ESignLiveSDK();
ESignLiveAPIObjects.package_x template = sdk.getPackage('E-_tmDsICwCkM2vqFuzVxF7NVQQ=');
template.name = 'This template has been updated - ' + Datetime.now().format();
sdk.helper.updatePackage(template,'E-_tmDsICwCkM2vqFuzVxF7NVQQ=');
Deleting a Template
To delete a template, use the the deletePackage() function. The following code will do this:
sdk.helper.deletePackage('E-_tmDsICwCkM2vqFuzVxF7NVQQ=');