使用REST DocuSign API从模板获取所有选项卡

时间:2013-11-27 17:30:50

标签: docusignapi

我想知道使用REST API从模板中获取所有选项卡的最佳方法是什么。

我目前要做的是获取所有收件人及其所有标签,以便我们可以默认某些值以及在创建信封时锁定已填充值的字段。

  • 获取我正在使用的收件人/信封/ {templateId} /收件人。
  • 要获取标签,我将循环浏览模板中的所有收件人,然后我将使用/ envelopes / {templateId} / recipients / {recipientId} / tabs。

我想知道这是否是最好的方法,因为我会收到尽可能多的电话给DocuSign,因为有接收者,如果有更好的方法,我不想拨打额外电话。

谢谢。

1 个答案:

答案 0 :(得分:3)

实际上,通过REST API获取模板的所有字段(选项卡)的方法更简单。只需拨打以下(单个)电话:

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

成功的回复将包含每个收件人类型的模板收件人的集合(即签名者代理商 carbonCopies 等等) - 任何这些集合中的每个收件人对象都将包含有关收件人选项卡的信息。例如,这里是包含两个签名者的模板的响应 - 每个签名者都拥有'几种不同类型的标签:

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