DocuSign REST api un-group tabs

2019-02-28 20:31发布

问题:

I need to ungroup the tabs in envelope which is created in 'draft' status so that if I move one SignHere tab position on one page, all other SignHere don't move. I did a GET request to get tabs and then a PUT to update the tabs, the communication is success, but the tabs are not ungrouped.

Steps followed:

Get Tabs for recipient

GET restapi/v2/accounts/{accountId}/envelopes/envelopeId/recipients/1/tabs

Response returns:

{
  "anchorString": "SIGNHERE",
  "anchorUnits": "pixels",
  "anchorXOffset": "0",
  "anchorYoffset": "0",
  "DocumentId": "1",
  "Name": "SignHere",
  "optional": "false",
  "pageNumber": "2",
  "RecipientId": "1",
  "TabLabel": "Sign Here",
  "xPosition": "63",
  "yPosition": "260"
}
  • Iterate through the SignHereTabs, Update the anchorString to empty string

  • Make PUT request using the updates tabs as request body and the recipientId and EnvelopeId as params.

PUT /v2/accounts/accountId/envelopes/envelopeId/recipients/recipientId/tabs

Request Body:

{
  "signHereTabs": [
    {
      "yPosition": "260",
      "xPosition": "63",
      "width": null,
      "TabLabel": "Sign Here",
      "tabid": "37dac2a5-c5fa-4726-b28a-3ec7af7e4189",
      "ScaleValue": "1.0",
      "required": null,
      "RecipientId": "1",
      "optional": "false",
      "Name": "SignHere",
      "fontSize": null,
      "font": null,
      "DocumentId": "1",
      "anchorYoffset": "0",
      "anchorXOffset": "0",
      "anchorUnits": "pixels",
      "anchorString": "",
      "anchorIgnoreIfNotPresent": null
    }
  ]
}

I get back success response System.HttpResponse[Status=OK, StatusCode=200]

  • After this I make POST request to view the envelope in SalesForce application POST https://demo.docusign.net/restapi/v2/accounts/accountId/envelopes/envelopeId/views/sender

But in the sender view opened I see SignHere tabs all tabs are UN-Grouped only on second page and not all the pages. In the GET request I see that I get pagenumber "2" in response which is the first occurrence of 'SignHere' in a 16 page document. I removed the pageNumber attribute in PUT request body, that did not help. Is there any way to apply ungroup to all the pages? Or how to GET the signhere tabs response which is for all the pages in document?

回答1:

You are only updating a single instance of the tab. So only one Tab is being ungrouped. Instead you should update all the Tab instances


Step I : Retrieve all Anchor tab locations

Use the listRecipientTabs api to retrieve the tabs for the recipient. Specify the query string parameter include_anchor_tab_locations=true to retrieve all the anchor tab locations.

GET /v2/accounts/{accId}/envelopes/{envId}/recipients/{recipId}/tabs?include_anchor_tab_locations=true


Step II : Update all anchor tab instances to ungroup

Use the updateRecipientTabs api to set anchorString='' for all tab instances. Other tab properties can be excluded in the PUT call.

PUT /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs

{
  "signHereTabs": [
    {
      "anchorString": "",
      "tabid": "37dac2a5-c5fa-4726-b28a-3ec7af7e4189"
    },
    {
      "anchorString": "",
      "tabid": "<Specify Tab Id here>"
    },
    {
      "anchorString": "",
      "tabid": "<Specify Tab Id here>"
    } 
  ]
}

See this answer for ungrouping tabs using the C# sdk.