Paul S.
Paul S.

Reputation: 149

Getting all tabs from a template using REST DocuSign API

I was wondering what the best approach is to get all the tabs from a template using the REST API.

What I am currently trying to do is get all the recipients and all of their tabs so that we can default some of the values as well as lock fields that have populated values when creating the envelope.

I was wondering if this would be the best approach as I would be making as many calls to DocuSign as there are recipients and don't want to make extra calls if there is a better way of doing this.

Thank you.

Upvotes: 1

Views: 1515

Answers (1)

Kim Brandl
Kim Brandl

Reputation: 13480

Actually, there's a simpler way to get all the fields (tabs) for a Template via the REST API. Simply make the following (single) call:

GET https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{templateId}}/recipients?include_tabs=true&include_extended=true

A successful response will contain a collection of the Template's Recipients for each recipient type (i.e., signers, agents, carbonCopies, etc.) -- and each recipient object within any of those collections will include information about the recipient's tabs. For example, here's the response for a Template that contains two Signers -- each 'owning' several tabs of various types:

{
    "signers": [
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "name": "Sign Here",
                        "tabLabel": "Signature 1",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "1",
                        "recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
                        "pageNumber": "1",
                        "xPosition": "74",
                        "yPosition": "96",
                        "tabId": "bb7df562-665c-4f8d-8395-56f0c2f6accf"
                    }
                ],
                "textTabs": [
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "address",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
                        "pageNumber": "1",
                        "xPosition": "74",
                        "yPosition": "257",
                        "tabId": "451365aa-f066-45b9-aa58-4d7da60f3039"
                    }
                ],
                "radioGroupTabs": [
                    {
                        "documentId": "1",
                        "recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
                        "groupName": "Radio Group 1",
                        "radios": [
                            {
                                "pageNumber": "1",
                                "xPosition": "185",
                                "yPosition": "165",
                                "value": "Radio 1",
                                "selected": "false",
                                "tabId": "25362e61-c421-466b-a13c-934bb3be0ac6",
                                "required": "True",
                                "locked": "False"
                            },
                            {
                                "pageNumber": "1",
                                "xPosition": "214",
                                "yPosition": "165",
                                "value": "Radio 2",
                                "selected": "false",
                                "tabId": "350f3efa-f2ba-4aaf-bd78-4b45dc475ee4",
                                "required": "True",
                                "locked": "False"
                            }
                        ]
                    }
                ],
                "listTabs": [
                    {
                        "listItems": [
                            {
                                "text": "Married",
                                "value": "M",
                                "selected": "false"
                            },
                            {
                                "text": "Single",
                                "value": "S",
                                "selected": "false"
                            },
                            {
                                "text": "Divorced",
                                "value": "D",
                                "selected": "false"
                            },
                            {
                                "text": "Widowed",
                                "value": "W",
                                "selected": "false"
                            }
                        ],
                        "value": "",
                        "width": 78,
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "tabLabel": "MaritalStatus",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
                        "pageNumber": "1",
                        "xPosition": "72",
                        "yPosition": "213",
                        "tabId": "b6e5b284-5c87-4a0c-9db5-e4d364ab1113"
                    }
                ]
            },
            "signInEachLocation": "false",
            "name": "",
            "email": "",
            "recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
            "recipientIdGuid": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
            "requireIdLookup": "false",
            "routingOrder": "1",
            "roleName": "Signer1",
            "status": "created",
            "templateLocked": "false",
            "templateRequired": "false"
        },
        {
            "tabs": {
                "signHereTabs": [
                    {
                        "name": "Sign Here",
                        "tabLabel": "Signature 8",
                        "scaleValue": 1,
                        "optional": "false",
                        "documentId": "1",
                        "recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
                        "pageNumber": "1",
                        "xPosition": "354",
                        "yPosition": "88",
                        "tabId": "1e1829ef-005d-4277-b7af-8758cfdf186a"
                    }
                ],
                "fullNameTabs": [
                    {
                        "name": "Full Name",
                        "tabLabel": "Full Name",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
                        "pageNumber": "1",
                        "xPosition": "354",
                        "yPosition": "183",
                        "tabId": "c33c0f3c-2f77-4985-b5b7-d538220a2f86"
                    }
                ],
                "textTabs": [
                    {
                        "height": 11,
                        "validationPattern": "",
                        "validationMessage": "",
                        "shared": "false",
                        "requireInitialOnSharedChange": "false",
                        "name": "Text",
                        "value": "",
                        "width": 42,
                        "required": "true",
                        "locked": "false",
                        "concealValueOnDocument": "false",
                        "disableAutoSize": "false",
                        "tabLabel": "Data Field 9",
                        "bold": "false",
                        "italic": "false",
                        "underline": "false",
                        "documentId": "1",
                        "recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
                        "pageNumber": "1",
                        "xPosition": "354",
                        "yPosition": "156",
                        "tabId": "80e5a803-b1d4-4175-97b4-09c6125f3143"
                    }
                ]
            },
            "signInEachLocation": "false",
            "name": "",
            "email": "",
            "recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
            "recipientIdGuid": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
            "requireIdLookup": "false",
            "routingOrder": "2",
            "roleName": "Signer2",
            "status": "created",
            "templateLocked": "false",
            "templateRequired": "false"
        }
    ],
    "agents": [],
    "editors": [],
    "intermediaries": [],
    "carbonCopies": [],
    "certifiedDeliveries": [],
    "inPersonSigners": [],
    "recipientCount": "2"
}

Upvotes: 3

Related Questions