RetrievingAll Signatures
  • 18 Nov 2024
  • 6 Minutes à lire
  • Sombre
    Lumière
  • PDF

RetrievingAll Signatures

  • Sombre
    Lumière
  • PDF

Résumé de l’article

Java SDK.NET SDKREST APIAPEX SDK

Java SDK

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

Once a transaction has been sent out for signing, you can retrieve all signatures on a specified document, for a specified signer. The following code will do this:

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.

Firs, retrieve your DocumentPackage object. The following code will do this:

DocumentPackage sentPackage = client.getPackage(packageId);

Then, using the OneSpan SignApprovalService, you can retrieve all signatures. Use the DocumentPackage, SignatureID objects, and documentID as parameters. The following code will do this:

List<Signature> signer1SignableSignatures = client
    .getApprovalService()
    .getAllSignableSignatures(sentPackage, documentId, signer1Id);

Finally, you can loop through each signature to retrieve any additional information, like the positioning of the signature, the accepted date, and so on.

for (Signature signature : signer1SignableSignatures) {
    System.out.println("Position of signature " + i + ": (" + signature.getX() + ", " + signature.getY() + ") on page " + signature.getPage());
    i++;
}

If the package contains an “accept only” document then the Approvals node will not have any signatures in it.

Results

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

.NET SDK

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

Once a transaction has been sent out for signing, you can retrieve all signatures on a specified document, for a specified signer. The following code will do this:

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.

Firs, retrieve your DocumentPackage object. The following code will do this:

 DocumentPackage sentPackage = client.GetPackage(packageId); 

Then, using the OneSpan SignApprovalService, you can retrieve all signatures. Use the DocumentPackage, SignatureID objects, and documentID as parameters. The following code will do this:

IList<Signature> signer1SignableSignatures = client.ApprovalService
    .GetAllSignableSignatures(sentPackage, documentId, signer1Id);

Finally, you can loop through each signature to retrieve any additional information, like the positioning of the signature, the accepted date, and so on.

foreach (Signature signature in signer1SignableSignatures)
{
    Debug.WriteLine("Position of signature " + i + ": (" + signature.X + ", " + signature.Y + ") on page " + signature.Page);
    i++;
}

If the package contains an “accept only” document then the Approvals node will not have any signatures in it.

Results

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

REST API

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

Once you have sent your transaction for signing, you can use the following code to retrieve all signatures for all signers in a document, use the PackageID,  and documentID as parameters.

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.

HTTP Request

GET /api/packages/{packageId}/documents/{documentId}

HTTP Headers

Accept: application/json; esl-api-version=11.21   
Authorization: Basic api_key 

Response Payload

{
    "description": "",
    "id": "ddcad715b41ed28d0d8b16580c829501f35d5ed836d800c0",
    "index": 0,
    "name": "purchase_order",
    "approvals": [
        {
            "id": "UMxe8ClLfEYK",
            "role": "15be0c69-b672-4314-9ffd-d3da69770caa",
            "signed": null,
            "accepted": null,
            "fields": [...],
            "name": ""
        },
        {
            ...
        }
    ],
    ...
}

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

Then, you can loop through each signature to retrieve any additional information, like the positioning of the signature, the accepted date, and so on.

You can also retrieve all signatures for a specific signer within one or multiple documents. To retrieve signatures from a single document, use the following code:

HTTP Request

GET /api/packages/{packageId}/documents/{documentId}/signers/{signerId}/approvals

HTTP Headers

Accept: application/json; esl-api-version=11.21   
Authorization: Basic api_key 

Response Payload

[
    {
        "id": "eZDydIrS1XQV",
        "optional": false,
        "name": "",
        "enforceCaptureSignature": false,
        "accepted": "2019-08-12T16:01:00Z",
        "signed": "2019-08-12T16:01:02Z",
        "role": "50a3431e-04e2-49b1-81c8-a5e2bc550932",
        "fields": [...],
        ...
    },
    {
        ...
    }
]

To retrieve all signatures from the transacion, remove the /documents/{documentId}" from the URL path. The following code will do this:

HTTP Request

GET /api/packages/{packageId}/signers/{signerId}/approvals

HTTP Headers

Accept: application/json; esl-api-version=11.21   
Authorization: Basic api_key 

Response Payload

[
    {
        "documentId": "efc058bf9f0c261947c62a8d199be5d5ea6495ca102c8076",
        "approvals": [
            ...
        ]
    },
    {
        "documentId": "default-consent",
        "approvals": [
            {
                "id": "339df19b-e8ee-4dd0-bdb8-d4f38bc368c5",
                "enforceCaptureSignature": false,
                "accepted": "2019-08-12T16:00:56Z",
                "signed": "2019-08-12T16:00:56Z",
                "role": "50a3431e-04e2-49b1-81c8-a5e2bc550932",
                "optional": false,
                "fields": [],
                "name": "",
                "data": null
            }
        ]
    },
    {
        "documentId": "91a88db05a2f122ab214ef6f5933219658ade8d81b7f1035",
        "approvals": []
    }
]

In response payload, all document IDs are listed with the signatures assigned to the signer. If the recipient doesn't have any signatures on a document, the approvals array will be empty.

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

description

string

Yes

No

n/a

sample consent document

id

string

Yes

No

n/a

ddcad715b41ed28d0d8b16580c829501f35d5ed836d800c0

extract

boolean

Yes

No

false

true / false

index

integer

Yes

No

0

0 / 1 / 2 ...

name

string

Yes

No

n/a

purchase_order

data

ese_document_texttag_extract_needed

boolean

Yes

No

false

false / true

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

pages

id

string

No

No

n/a

n/a

top

integer

No

No

0

n/a

height

integer

No

No

1030

n/a

width

integer

No

No

796

n/a

left

integer

No

No

0

n/a

index

integer

No

No

0

n/a

version

integer

No

No

0

n/a

APEX SDK

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

Once a transaction has been sent out for signing, you can retrieve all signatures on a specified document, for a specified signer. The following code will do this:

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.

Firs, retrieve your PackageID. The following code will do this:

Then, you can retrieve all signatures. Use the PackageID, SignatureID , and documentID as parameters. The following code will do this:

public List<ESignLiveAPIObjects.Approval> getAllSignableSignatures(
    String packageId, 
    String documentId, 
    String signerId
)

Finally, you can loop through each signature to retrieve any additional information, like the positioning of the signature, the accepted date, and so on.

List<ESignLiveAPIObjects.Approval> allSignableSignatures = getAllSignableSignatures(packageId, documentId, signerId);

for (ESignLiveAPIObjects.Approval approval : allSignableSignatures) {
    System.debug('Approval ID: ' + approval.id);
    
    if (approval.fields != null && approval.fields.size() > 0) {
        for (ESignLiveAPIObjects.Field field : approval.fields) {
            System.debug('----Field ID: ' + field.id + ', TYPE: ' + field.type + ' ' + field.subtype);
        }
    }
}

If the package contains an “accept only” document then the Approvals node will not have any signatures in it.

Results

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


Cet article vous a-t-il été utile ?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Ozzy, facilitant la découverte de connaissances grâce à l’intelligence conversationnelle