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.
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.
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.
Request Payload Table
Property | Type | Editable | Required | Default | Sample Values(s) |
---|---|---|---|---|---|
status | string | Yes | No | DRAFT | DRAFT / SENT / COMPLETED / ARCHIVED / DECLINED / OPTED_OUT / EXPIRED |
type | string | Yes | No | PACKAGE | PACKAGE / TEMPLATE / LAYOUT |
name | string | Yes | Yes | n/a | Document Attributes Example |
documents | |||||
name | string | Yes | No | n/a | sample doc |
id | string | Yes | No | n/a | sample-contract |
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 | Signer1 |
id | string | Yes | No | n/a | ExampleSignatureId |
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 | [email protected] | |
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 |
data | |||||
First Name | string | Yes | No | n/a | Bill |
Last Name | string | Yes | No | n/a | Johnson |
Signing Order | string | Yes | No | n/a | 1 |
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.