Yogeshgyw

Tried Text Anchors but getting Error 400

0 votes

I'm trying to place signature using the text anchors in Payload in API Body by referring the blog(OneSpan Sign How To: Using Text Anchors | OneSpan), but I'm getting the below validation error (Currently testign this in Postman), Also attaching the Document that has to be uploaded.

Error

{

    "messageKey": "error.validation.validateApproval.noRolesOnApproval",

    "parameters": {

        "approvalDataName": "nloPAFsepjEO"

    },

    "message": "No role specified as part of this approval.",

    "code": 400,

    "name": "Validation Error"

}

The Payload i used

{
  "roles": [
    {
      "id": "Recipient",
      "type": "SIGNER",
      "index": 1,
      "signers": [
        {
          "firstName": "John",
          "lastName": "Smith",
          "email": "[email protected]"
        }
      ],
      "name": "Recipient"
    },
    {
      "id": "client",
      "type": "SIGNER",
      "index": 2,
      "signers": [
        {
          "firstName": "Bob",
          "lastName": "Murray",
          "email": "[email protected]"
        }
      ],
      "name": "client"
    }
  ],
  "documents": [
    {
      "approvals": [
        {
          "fields": [
            {
              "type": "SIGNATURE",
              "extract": false,
              "extractAnchor": {
                "text": "Signature of the Client",
                "index": 0,
                "width": 150,
                "height": 40,
                "anchorPoint": "TOPLEFT",
                "characterIndex": 0,
                "leftOffset": 0,
                "topOffset": -50
              },
              "left": 0,
              "subtype": "FULLNAME",
              "top": 0
            },
            {
              "value": null,
              "type": "INPUT",
              "binding": "{signer.name}",
              "extract": false,
              "extractAnchor": {
                "text": "(hereafter referred to as",
                "index": 0,
                "width": 150,
                "height": 20,
                "anchorPoint": "TOPRIGHT",
                "characterIndex": 0,
                "leftOffset": -175,
                "topOffset": -5
              },
              "left": 0,
              "subtype": "LABEL",
              "top": 0
            },
            {
              "value": null,
              "type": "INPUT",
              "binding": "{approval.signed}",
              "extract": false,
              "extractAnchor": {
                "text": "Date",
                "index": 0,
                "width": 75,
                "height": 40,
                "anchorPoint": "TOPRIGHT",
                "characterIndex": 4,
                "leftOffset": 10,
                "topOffset": -30
              },
              "left": 0,
              "subtype": "LABEL",
              "top": 0
            }
          ],
          "role": "client"
        },
        {
          "fields": [
            {
              "type": "SIGNATURE",
              "extract": false,
              "extractAnchor": {
                "text": "Signature of the Contractor",
                "index": 0,
                "width": 150,
                "height": 40,
                "anchorPoint": "TOPLEFT",
                "characterIndex": 0,
                "leftOffset": 0,
                "topOffset": -50
              },
              "left": 0,
              "subtype": "FULLNAME",
              "top": 0
            },
            {
              "value": null,
              "type": "INPUT",
              "binding": "{signer.name}",
              "extract": false,
              "extractAnchor": {
                "text": "(hereafter referred to as",
                "index": 1,
                "width": 150,
                "height": 20,
                "anchorPoint": "TOPRIGHT",
                "characterIndex": 0,
                "leftOffset": -175,
                "topOffset": -5
              },
              "left": 0,
              "subtype": "LABEL",
              "top": 0
            },
            {
              "value": null,
              "type": "INPUT",
              "binding": "{approval.signed}",
              "extract": false,
              "extractAnchor": {
                "text": "Date",
                "index": 1,
                "width": 75,
                "height": 40,
                "anchorPoint": "TOPRIGHT",
                "characterIndex": 4,
                "leftOffset": 10,
                "topOffset": -30
              },
              "left": 0,
              "subtype": "LABEL",
              "top": 0
            }
          ],
          "role": "contractor"
        }
      ],
      "name": "Sample Contract"
    }
  ],
  "name": "Text Anchor Extraction Example REST API",
  "type": "PACKAGE",
  "language": "en",
  "autoComplete": true,
  "status": "DRAFT"
}

 


Attachments
Approved Answer

Reply to: Tried Text Anchors but getting Error 400

0 votes

(1)To check the status of a transaction, it's more suggested to set up a callback listener and monitor the PACKAGE_COMPLETE event.

Otherwise, you can retrieve the transaction status via this API:

GET /api/packages/{packageId}/signingStatus

(2)You can download the signed documents and evidence summary via these two APIs:
GET /api/packages/{packageId}/documents/zip

GET /api/packages/{packageId}/evidence/summary

 

Duo

 

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Tried Text Anchors but getting Error 400

0 votes

Hi Yogeshgyw,

 

Please try the JSON I replied in your other post. :)

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Tried Text Anchors but getting Error 400

0 votes

as you suggested it worked thanks. currently the document is falling into drafts, instead how to trigger the approval process?

 

{

"documents": [

{

"approvals": [

{

"id": "ClientSignature",

"role": "Signer1",

"fields": [

{

"subtype": "FULLNAME",

"extract": false,

"extractAnchor": {

"text": "Client Signature",

"index": 0,

"width": 150,

"height": 50,

"anchorPoint": "TOPRIGHT",

"characterIndex": 0,

"leftOffset": 0,

"topOffset": 0

},

"type": "SIGNATURE",

"name": "ExampleSignatureId"

}

],

"name": ""

},

{

"id": "RequesterSignature",

"role": "Signer2",

"fields": [

{

"subtype": "FULLNAME",

"extract": false,

"extractAnchor": {

"text": "Requester Signature",

"index": 0,

"width": 150,

"height": 50,

"anchorPoint": "TOPRIGHT",

"characterIndex": 0,

"leftOffset": 0,

"topOffset": 0

},

"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"

},

{

"id": "Signer2",

"type": "SIGNER",

"signers": [

{

"email": "[email protected]",

"firstName": "Mary",

"lastName": "Doe",

"id": "Signer2"

}

],

"name": "Signer2"

}

],

"name": "Example Package"

}


Reply to: Tried Text Anchors but getting Error 400

0 votes

Hi Yogeshgyw,

 

If you set status as SENT in your JSON, the transaction will be sent out directly. Alternatively, you can create the transaction in DRAFT status first, then make a PUT call to update the status:
PUT /api/packages/{packageId}

{"status": "SENT"}

 

Duo

Duo Liang OneSpan Evangelism and Partner Integrations Developer


Reply to: Tried Text Anchors but getting Error 400

0 votes

Thanks a lot Duo_Liang

Apparently could you be able to offer some assistance with the APIs used to check the status of the Document and download the fully signed/completed Document.


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off