DocuSign复合模板 - 上传的文档未显示

时间:2018-01-23 09:09:35

标签: docusignapi docusigncompositetmplts

我正在使用DocuSign RestAPI,尝试使用Composite Template创建信封。

我的目的是将PDF文档附加到现有模板的末尾。

使用以下JSON到POST /v2/accounts/{accountId}/envelopes,我可以显示模板,但不能显示附加的PDF文档。

我错过了什么?

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"{TEMPLATE_ID}"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"1",
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"applicant@example.com",
                "name":"applicant",
                "recipientId":1,
                "roleName":"Applicant",
              },
              {
                "clientUserId":"2345",
                "email":"underwriter@example.com",
                "name":"underwriter",
                "recipientId":2,
                "roleName":"Underwriter",
              }
            ]
          }
        },
        {
          "sequence":"2",
          "documents":[
            {
              "documentBase64": "JVBERi0xLjMKJf////8KMSAwIG9iago8PCAvQ3JlYXRvciA8ZmVmZjAwNTAwMDcyMDA2MTAwNzcwMDZlPgovUHJvZHVjZXIgPGZlZmYwMDUwMDA3MjAwNjEwMDc3MDA2ZT4KPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL0NhdGFsb2cKL1BhZ2VzIDMgMCBSCj4+CmVuZG9iagozIDAgb2JqCjw8IC9UeXBlIC9QYWdlcwovQ291bnQgMQovS2lkcyBbNSAwIFJdCj4+CmVuZG9iago0IDAgb2JqCjw8IC9MZW5ndGggODEKPj4Kc3RyZWFtCnEKCkJUCjM2IDc0Ny4zODQgVGQKL0YxLjAgMTIgVGYKWzw0ODY1NmM2YzZmMjA1Nz4gMzAgPDZmNzI+IC0xNSA8NmM2ND5dIFRKCkVUCgpRCgplbmRzdHJlYW0KZW5kb2JqCjUgMCBvYmoKPDwgL1R5cGUgL1BhZ2UKL1BhcmVudCAzIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIuMCA3OTIuMF0KL0NvbnRlbnRzIDQgMCBSCi9SZXNvdXJjZXMgPDwgL1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldCi9Gb250IDw8IC9GMS4wIDYgMCBSCj4+Cj4+Cj4+CmVuZG9iago2IDAgb2JqCjw8IC9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovQmFzZUZvbnQgL0hlbHZldGljYQovRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZwo+PgplbmRvYmoKeHJlZgowIDcKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDAxMDkgMDAwMDAgbiAKMDAwMDAwMDE1OCAwMDAwMCBuIAowMDAwMDAwMjE1IDAwMDAwIG4gCjAwMDAwMDAzNDYgMDAwMDAgbiAKMDAwMDAwMDUyNCAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDcKL1Jvb3QgMiAwIFIKL0luZm8gMSAwIFIKPj4Kc3RhcnR4cmVmCjYyMQolJUVPRgo=",
              "documentId":"10",
              "fileExtension":"PDF",
              "name":"addendum",
            }
          ],
          "recipients":{
            "signers":[
              {
                "clientUserId":"1234",
                "email":"applicant@example.com",
                "name":"applicant",
                "recipientId":1,
                "roleName":"Applicant",
                ,
                {
                  "clientUserId":"2345",
                  "email":"underwriter@example.com",
                  "name":"underwriter",
                  "recipientId":2,
                  "roleName":"Underwriter",
                }
            ]
          }
        }
      ]
    }
  ]
}

1 个答案:

答案 0 :(得分:2)

如果您只想附加文档,那么JSON结构下方将帮助您:

您需要有两个复合模板。第一个CompositeTemplate将用于从serverTemplate添加文档并提供收件人详细信息。第二个复合模板只会将PDF文档添加到信封中。

{
  "status":"sent",
  "emailBlurb":"envelope_body",
  "emailSubject":"envelope_subject",
  "compositeTemplates":[
    {
      "compositeTemplateId":"1",
      "serverTemplates":[
        {
          "sequence":"1",
          "templateId":"{TEMPLATE_ID}"
        }
      ],
      "inlineTemplates":[
        {
          "sequence":"2",
          "recipients":{
            "signers":[
                {
                    "clientUserId":"1234",
                    "email":"applicant@example.com",
                    "name":"applicant",
                    "recipientId":"1",
                    "roleName":"Applicant"
                },
                {
                    "clientUserId":"1234",
                    "email":"underwriter@example.com",
                    "name":"underwriter",
                    "recipientId":"2",
                    "roleName":"Underwriter"
                }
            ]
          }
        }
      ]
    },
    {
        "compositeTemplateId":"2",
        "inlineTemplates":[
        {
          "sequence":"3",
          "documents":[
            {
              "documentBase64": "JVBERi0xLjMKJf////8KMSAwIG9iago8PCAvQ3JlYXRvciA8ZmVmZjAwNTAwMDcyMDA2MTAwNzcwMDZlPgovUHJvZHVjZXIgPGZlZmYwMDUwMDA3MjAwNjEwMDc3MDA2ZT4KPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL0NhdGFsb2cKL1BhZ2VzIDMgMCBSCj4+CmVuZG9iagozIDAgb2JqCjw8IC9UeXBlIC9QYWdlcwovQ291bnQgMQovS2lkcyBbNSAwIFJdCj4+CmVuZG9iago0IDAgb2JqCjw8IC9MZW5ndGggODEKPj4Kc3RyZWFtCnEKCkJUCjM2IDc0Ny4zODQgVGQKL0YxLjAgMTIgVGYKWzw0ODY1NmM2YzZmMjA1Nz4gMzAgPDZmNzI+IC0xNSA8NmM2ND5dIFRKCkVUCgpRCgplbmRzdHJlYW0KZW5kb2JqCjUgMCBvYmoKPDwgL1R5cGUgL1BhZ2UKL1BhcmVudCAzIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIuMCA3OTIuMF0KL0NvbnRlbnRzIDQgMCBSCi9SZXNvdXJjZXMgPDwgL1Byb2NTZXQgWy9QREYgL1RleHQgL0ltYWdlQiAvSW1hZ2VDIC9JbWFnZUldCi9Gb250IDw8IC9GMS4wIDYgMCBSCj4+Cj4+Cj4+CmVuZG9iago2IDAgb2JqCjw8IC9UeXBlIC9Gb250Ci9TdWJ0eXBlIC9UeXBlMQovQmFzZUZvbnQgL0hlbHZldGljYQovRW5jb2RpbmcgL1dpbkFuc2lFbmNvZGluZwo+PgplbmRvYmoKeHJlZgowIDcKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDE1IDAwMDAwIG4gCjAwMDAwMDAxMDkgMDAwMDAgbiAKMDAwMDAwMDE1OCAwMDAwMCBuIAowMDAwMDAwMjE1IDAwMDAwIG4gCjAwMDAwMDAzNDYgMDAwMDAgbiAKMDAwMDAwMDUyNCAwMDAwMCBuIAp0cmFpbGVyCjw8IC9TaXplIDcKL1Jvb3QgMiAwIFIKL0luZm8gMSAwIFIKPj4Kc3RhcnR4cmVmCjYyMQolJUVPRgo=",
              "documentId":"10",
              "fileExtension":"PDF",
              "name":"addendum",
            }
          ]
        }
      ]
    }
  ]
}