aarond | Posts: 2

Adding Anchor tags to a document

0 votes
I have been hitting a bit of a brick wall trying to add text anchor tags to an uploaded document. Let my explain what I have been attempting to achieve. First I upload a document to an existing package, the package already contains a new role that I have created. Both the package and the role are created though the sandbox web interface just to bootstrap the environment. I then progmatically upload a document with the following details for example I POST a multipart request to https://sandbox.esignlive.com/api/packages/f7d04bb5-f9df-4d7a-95d7-50f84a7ebb4f/documents. note: I would swap the :id to what ever new package I had created to work with. This uploads find a returns a successful response like following:

{
         "status": "",
    "description": "",
      "approvals": [],
          "pages": [
         {
                "top": 0.0,
             "height": 1030.0,
               "left": 0.0,
              "width": 796.0,
                 "id": "2bbb4929f5561c75_1.png",
              "index": 0,
            "version": 462978
        }
    ],
       "external": nil,
        "extract": false,
             "id": "a8eeb13740979ff9",
           "data": nil,
          "index": 1,
         "fields": [],
           "name": "test_form",
           "size": 6466
}
I then perform a GET request just to confirm to document is there. I know this step is not really needed, but I'm just trying to break it down while I'm trying to debug. I take the name and index from the response and use them to create the following request payload for a PUT request

{
  "name": "test_form",
  "index": 1,
  "approvals": [
    {
      "fields": [
        {
          "type": "SIGNATURE",
          "width": 200,
          "height": 50,
          "page": 0,
          "extract": false,
          "extractAnchor": {
            "text": "Nondisclosure",
            "index": 0,
            "width": 150,
            "height": 40,
            "anchorPoint": "BOTTOMRIGHT",
            "characterIndex": 9,
            "leftOffset": 0,
            "topOffset": 0
          },
          "left": 0,
          "subtype": "FULLNAME",
          "top": 0
        }
      ],
      "role": "Signer1"
    }
  ],
  "extract": true
}
This would give me the following response.

{
     "packageId": nil,
    "messageKey": "error.validation.packageManagement.invalidDocument",
     "technical": "Document: c320a4f84cc9c938 was not found for Process with Guid: f7d04bb5-f9df-4d7a-95d7-50f84a7ebb4f",
        "entity": nil,
          "code": 404,
       "message": "Can not find specified document.",
          "name": "Resource Not Found"
}
If I remove the index key from the original PUT request, I get a successful response, but the role isn't assigned and sandbox web UI for that pack will crash with and error in the console about a missing role. I can get the package to load in the web UI again if I make a DELETE request to the api and remove the affected document. I'm at a bit of a loss as where to go from here.

DougExner | Posts: 6

Reply to: Adding Anchor tags to a document

0 votes
The main problem was that you are referring to the role name “signer1” in the approval, not the role id (e.g. “3bd78206-0bec-478b-b7a5-6c0d3f07710e”) If you had created this package yourself, you could have created a more meaningful id that you specify and don’t have to look up after creation, but the sandbox web interface just lets the system auto-create one. I usually create the role name & id as the same, as the context is limited to the package.

aarond | Posts: 2

Reply to: Adding Anchor tags to a document

0 votes
Thanks Doug for your response. Using the id instead of the role name did allow me to add a signature to the document. The problem I am getting though is that the signature box is always in the top left corner. As mentioned I am trying to take advantage of the text anchor feature to locate the signature box with at the location of some arbitaty text. below is and example of the PUT request payload I am using to create the signature box, its based on the one provided in your documentation.

    {  
      "name": "test_form",
      "approvals": [  
        {  
           "fields": [  
              {  
                 "type": "SIGNATURE",
                 "width": 200.0,
                 "height": 50.0,
                 "page": 0,
                 "extract": false,
                 "extractAnchor": {
                      "text": "kitchen",
                      "index": 0,
                      "width": 150,
                      "height": 40,
                      "anchorPoint": "BOTTOMRIGHT",
                      "characterIndex": 9,
                      "leftOffset": 0,
                      "topOffset": 0
                    },
                 "left": 0.0,
                 "subtype": "FULLNAME",
                 "top": 0.0
              }
           ],
           "role": "c96f576f-72ac-4a7e-95b1-4053ee41e4d5"
        }
      ],
      "extract": true
    }

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