DocuSign API:自定义字段填充

时间:2018-02-06 20:28:25

标签: docusignapi

我对“标签”和“自定义字段”之间的区别感到困惑,或许 -

当我将json发送到DocuSign API的baseURL /信封时,要求API发送带有模板的信封,它可以正常工作:

{ "accountId": "xxx",
   "status": "sent",
   "emailSubject": "Please sign this document",
   "emailBlurb": "Here's a document for you to sign",
   "templateId": "xxxx",
   "templateRoles": [
        {
            "email": "test@email.com",
            "name": "Test Person",
            "roleName": "parent_signer" }] }

当我尝试为自定义字段填充添加参数时,出现400错误:

{ "accountId": "xxx",
   "status": "sent",
   "emailSubject": "Please sign this document",
   "emailBlurb": "Here's a document for you to sign",
   "templateId": "xxxx",
   "templateRoles": [
        {
            "email": "test@email.com",
            "name": "Test Person",
            "tabs": [
               { "textTabs":
                  [
                     {"tabLabel": "Doc_Name",
                      "name": "Doc_Name",
                      "value": "Doc Name Data Would Go Here"}
                  ]
               }
            ],
            "roleName": "parent_signer" }] }

我相关模板中的单个文档包含带有这些名称的自定义字段。 https://imgur.com/z519zm3

2 个答案:

答案 0 :(得分:1)

您需要指定需要显示标签的文档和页面。 在JSON中,它看起来如下所示:

"textTabs": [
    {
        "tabLabel": "Doc_Name",
        "name": "Doc_Name",
        "value": "Doc Name Data Would Go Here",
        "DocumentId": "123",
        "PageNumber": "1"
    }

答案 1 :(得分:1)

“ tabs”不是数组。这里有一个docusign的例子: https://developers.docusign.com/esign-rest-api/guides/features/templates

您的代码应如下所示:

    ...
    "templateRoles": [             // is an array
        {
            "email": "test@email.com",
            "name": "Test Person",
            "tabs": {              // is not an array (an object)
                "textTabs": [      // is an array (of objects)
                    {
                        "tabLabel": "Doc_Name", // should match Template "Data Label"
                        "name": "Doc_Name", // this field is unnecessary
                        "value": "Doc Name Data Would Go Here"
                    }
                ] // , other arrays of tabs like checkboxTabs may go here as well
            }
            "roleName": "parent_signer" }] }