OneSpan SDK to OneSpan REST -- AddDocument
Wednesday, July 19, 2023 at 06:36amWe are in process of changing SDK to REST in our project
Need help mapping the SDK methods to REST, In SDK add document we have SignatureFields, Signature Editable fields, Initial Fields and AcceptanceFields?
Could you provide us a sample REST AddDocument request covering all above fields?
Attached is our internal request that we are using for creating document in SDK, it would be great if we get mapping for the same.
Reply to: OneSpan SDK to OneSpan REST -- AddDocument
Wednesday, July 19, 2023 at 09:57amHi anilsha,
Thanks for your post!
By reading your local modelling, I believe (1) SignatureFields / Initial Fields means the two signature types click-to-sign and initial signature; (2) Signature Editable fields is the textfield that is related to these two types of signature and injectedFields should be label field which is uneditable during the signing; (3) AcceptanceFields is an accept-only signature without fields; (4) The way how you locate the signatures and fields is called text anchor (5) SDK uses email to match signers, while in RESTful API, you use role ID to reference a signer (6)You mainly need field validation for text fields
Based on that, I will give an API example to upload a document (see attachment) where Signer1 has a click-to-sign signature with a label field and a text field; Signer2 has an initials siganture; Signer3 is accept-only without any fields:
API: upload document
POST /api/packages/{packageId}/documents
Authorization: Basic {your_api_key}
Accept: text/html; esl-api-version=11
Content-Type: multipart/form-data
-F '[email protected];type=application/pdf'
-F 'payload=
{
"name": "Document1",
"id": "Document1",
"approvals": [
{
"role": "Signer1",
"fields": [
{
"type": "SIGNATURE",
"extract": false,
"extractAnchor": {
"text": "your_text_anchor_for_click_to_sign_signature",
"index": 0,
"width": 150,
"height": 40,
"anchorPoint": "TOPLEFT",
"characterIndex": 0,
"leftOffset": 0,
"topOffset": 0
},
"subtype": "FULLNAME"
},
{
"type": "INPUT",
"extract": false,
"extractAnchor": {
"text": "your_text_anchor_for_text_field",
"index": 0,
"width": 150,
"height": 20,
"anchorPoint": "TOPRIGHT",
"characterIndex": 0,
"leftOffset": 0,
"topOffset": 0
},
"validation": {
"required": false,
"maxLength": null,
"minimumRequired": null,
"maximumRequired": null,
"errorMessage": "",
"errorCode": null,
"minLength": null,
"pattern": ""
},
"subtype": "TEXTFIELD"
},
{
"type": "INPUT",
"extract": false,
"extractAnchor": {
"text": "your_text_anchor_for_label_field",
"index": 0,
"width": 150,
"height": 20,
"anchorPoint": "TOPRIGHT",
"characterIndex": 0,
"leftOffset": 0,
"topOffset": 0
},
"subtype": "LABEL"
}
]
},
{
"role": "Signer2",
"fields": [
{
"type": "SIGNATURE",
"extract": false,
"extractAnchor": {
"text": "your_text_anchor_for_initials_signature",
"index": 0,
"width": 150,
"height": 40,
"anchorPoint": "TOPLEFT",
"characterIndex": 0,
"leftOffset": 0,
"topOffset": 0
},
"subtype": "INITIALS"
}
]
},
{
"role": "Signer3"
}
]
}
Duo