Docusign是否通过电子邮件两次发送文档?

时间:2018-12-11 14:57:37

标签: docusignapi docusigncompositetmplts

我目前正在测试docusign签名API,并且在通过模板创建信封时遇到问题。电子邮件将我的文档发送了两次,重复了一次,我似乎无法解决它而又没有弄错其他任何东西。

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
                {
                    "clientUserId":"1234",
                    "email":"myemail",
                    "name":"applicant",
                    "recipientId":"1",
                    "roleName":"Applicant"
                }
                
            ]
          }
        }
      ]
    },
    {
        "compositeTemplateId":"1",
        "inlineTemplates":[
        {
          "sequence":"3",
          "documents":[
            {
              "documentBase64": " - insert base64 here",
              "documentId":"10",
              "fileExtension":"PDF",
              "name":"addendum",
            }
          ]
        }
      ]
    }
  ]
}      

1 个答案:

答案 0 :(得分:1)

您上面的请求正在使用服务器端模板(包含文档),但是您还在请求中指定了一个文档(base64编码的内容)。结果将是信封中的两个文档。

如果您不希望包含该文档,则应删除第二个复合模板块。例如

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"myemail",
                "name":"applicant",
                "recipientId":"1",
                "roleName":"Applicant"
              }
            ]
          }
        }
      ]
    }
  ]
} 

如果您想将服务器端模板应用于请求中的文档,则这些模板必须属于同一CompositeTemplate块。例如。像这样的东西:

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"insert template id"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"myemail",
                "name":"applicant",
                "recipientId":"1",
                "roleName":"Applicant"
              }
            ]
          }
        }
      ],
      "document": {
        "documentBase64": " - insert base64 here",
        "documentId":"10",
        "fileExtension":"PDF",
        "name":"addendum",
      }
    }
  ]
}