To download the full code sample see our Code Share site.

Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want.

Customized data can also be applied at the transaction level. For more information, see Document Attributes.

The following code shows you how to edit your DocumentPackage object to add package attributes.

DocumentPackage superDuperPackage1=newPackageNamed("Policy " + new SimpleDateFormat("HH:mm:ss").format(new Date())).describedAs("This is a package created using the e-SignLive SDK").expiresAt(new Date()).withEmailMessage("This message should be delivered to all signers").withSigner(newSignerWithEmail("[email protected]").withCustomId("Client1").withFirstName("John").withLastName("Smith").withTitle("Managing Director").withCompany("Acme Inc.")).withDocument(newDocumentWithName("First Document").fromStream(new java.io.FileInputStream(DOCUMENT_PATH), DocumentType.PDF).withSignature(signatureFor("[email protected]").onPage(0).withField(FieldBuilder.checkBox().onPage(0).atPosition(400, 200).withValue("x")).atPosition(100, 100))).withAttributes(newDocumentPackageAttributes().withAttribute("First Name", "Bill").withAttribute("Last Name", "Johnson").withAttribute("Signing Order", "1").build()).build();  

Retrieving your Attributes

Attributes are set on a transaction level. To retrieve your attributes, you will first need to retrieve your transaction. Then, with your DocumentPackage object, use the getAttributes() and getContents() methods to retrieve your attributes. Attributes will be returned to you as a map.

  DocumentPackage retrievedPackage = eslClient.getPackage(packageId);
Map < String, Object > attributes = retrievedPackage.getAttributes().getContents();
for (Map.Entry < String, Object > entry: attributes.entrySet()) {
	System.out.println(entry.getKey() + ": " + entry.getValue());
} 

Results

Here is an example of what you can expect to see once you have run your code.

3

To download the full code sample see our Code Share site.

Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want.

Customized data can also be applied at the transaction level. For more information, see Document Attributes.

The following code shows you how to edit your DocumentPackage object to add package attributes.

  DocumentPackage superDuperPackage = PackageBuilder.NewPackageNamed("Policy " + DateTime.Now).DescribedAs("This is a package created using the e-SignLive SDK").ExpiresOn(DateTime.Now.AddMonths(1)).WithEmailMessage("This message should be delivered to all signers").WithSigner(SignerBuilder.NewSignerWithEmail("[email protected]").WithCustomId("Client1").WithFirstName("John").WithLastName("Smith").WithTitle("Managing Director").WithCompany("Acme Inc.")).WithDocument(DocumentBuilder.NewDocumentNamed("First Document").FromFile(@ "C:/Users/hhaidary/Desktop/pdf/doc1.pdf").WithSignature(SignatureBuilder.SignatureFor("[email protected]").OnPage(0).WithField(FieldBuilder.CheckBox().OnPage(0).AtPosition(400, 200).WithValue("x")).AtPosition(100, 100))).WithAttributes(new DocumentPackageAttributesBuilder().WithAttribute("First Name", "Bill").WithAttribute("Last Name", "Johnson").WithAttribute("Signing Order", "1").Build()).Build();  

Retrieving your Attributes

Attributes are set on a transaction level. To retrieve your attributes, you will first need to retrieve your transaction. Then, with your DocumentPackage object, use the getAttributes() and getContents() methods to retrieve your attributes. Attributes will be returned to you as a map.

  DocumentPackage retrievedPackage = eslClient.GetPackage(packageId);
IDictionary < string, Object > attributes = retrievedPackage.Attributes.Contents;
foreach(KeyValuePair < string, Object > entry in attributes) {
	Debug.WriteLine(entry.Key + ": " + entry.Value);
} 

Results

Here is an example of what you can expect to see once you have run your code.

3

To download the full code sample see our Code Share site.

Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want.

Customized data can also be applied at the transaction level. For more information, see Document Attributes.

The following code shows you how to edit your DocumentPackage object to add package attributes.

HTTP Request

POST /api/packages

HTTP Headers

Accept: application/json 
Content-Type: multipart/form-data 
Authorization: Basic api_key  

Request Payload

  -- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "file";
filename = "testDocumentExtraction.pdf"
Content - Type: application / pdf % PDF - 1.5 % µµµµ 1 0 obj < >>> endobj....-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t Content - Disposition: form - data;
name = "payload" {
	"documents": [{
		"approvals": [{
			"id": "ExampleSignatureId",
			"role": "Signer1",
			"fields": [{
				"page": 0,
				"top": 200,
				"subtype": "LABEL",
				"height": 50,
				"left": 100,
				"width": 200,
				"id": "myLabelField",
				"type": "INPUT",
				"value": "Example label field value"
			}, {
				"page": 0,
				"top": 100,
				"subtype": "FULLNAME",
				"height": 50,
				"left": 100,
				"width": 200,
				"type": "SIGNATURE",
				"name": "ExampleSignatureId"
			}],
			"name": ""
		}],
		"id": "sample-contract",
		"name": "Test Document"
	}],
	"status": "DRAFT",
	"type": "PACKAGE",
	"roles": [{
		"id": "Signer1",
		"type": "SIGNER",
		"signers": [{
			"email": "[email protected]",
			"firstName": "John",
			"lastName": "Smith",
			"id": "Signer1"
		}],
		"name": "Signer1"
	}],
	"name": "Example Package",
	"data": {
		"First Name": "Bill",
		"Last Name": "Johnson",
		"Signing Order": "1"
	}
}-- -- --WebKitFormBoundary1bNO60n7FqP5WO4t--  

For a complete description of each field, see the Request Payload table below.

Response Payload

  { "id": "9sKhW-h-qS9m6Ho3zRv3n2a-rkI=" }  

Attributes are set on a package level. Therefore, you will need to get your package JSON in order to retrieve your package attributes.

Results

Here is an example of what you can expect to see once you have run your code.

3

Request Payload Table

PropertyTypeEditableRequiredDefaultSample Values(s)
statusstringYesNoDRAFTDRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED
typestringYesNoPACKAGEPACKAGE / TEMPLATE / LAYOUT
namestringYesYesn/aDocument Attributes Example
documents
namestringYesNon/asample doc
idstringYesNon/asample-contract
approvals
fields
subtypestringYesNon/aFULLNAME / INITIALS / CAPTURE / MOBILE_CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / DATE / RADIO / LIST
typestringYesNon/aSIGNATURE / INPUT
extractbooleanYesNofalsetrue / false
heightintegerYesNo5050 / 100 / 150 ...
leftintegerYesNo050 / 100 / 150 ...
pageintegerYesNo00 / 1 / 2 ...
topintegerYesNo050 / 100 / 150 ...
widthintegerYesNo20050 / 100 / 150 ...
rolestringYesNon/aSigner1
idstringYesNon/aExampleSignatureId
roles
idstringYesNon/aClient1
namestringYesNon/aClient1
typestringYesNoSIGNERSIGNER / SENDER
signers
emailstringYesYesn/a[email protected]
firstNamestringYesYesn/aJohn
lastNamestringYesYesn/aSmith
phonestringYesNon/a514-555-8888
idstringYesNon/aClient1
companystringYesNon/aAcme Inc.
titlestringYesNon/aManaging Director
data
First NamestringYesNon/aBill
Last NamestringYesNon/aJohnson
Signing OrderstringYesNon/a1

To download the full code sample see our Code Share site.

Document attributes are customized data related to a document in a transaction, or to all data in a transaction. This data is not interpreted by OneSpan Sign. As such, the users of this data are free to store and interpret whatever data they want.

The first step is to create a package. If you need a comparison to the basic object creation procedure, or if this is the first time creating a transaction, see Creating and Sending a Transaction.

Once you have retrieved your package ID, use the following encapsulated function to pass the package ID and attributes in a Map as parameters.

  public void addAttributes(String packageId, Map<String, Object> attributes)  

Retrieving your Attributes

Use the following code to retrieve your attributes at a package level. These attributes are passed as a map, using the PackageID.

  public Map<String, Object> getAttributes(String packageId)  

Results

Here is an example of what you can expect to see once you have run your code.

Capture