如何在DocuSign API中将服务器模板应用于信封文档? [英] How do I apply a server template to envelope document in DocuSign API?

查看:36
本文介绍了如何在DocuSign API中将服务器模板应用于信封文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个客户登录他们的DS帐户,上传一个17页的PDF文件,单击侧面的操作链接,然后选择应用模板".该模板包含选项卡和角色.他们填写DS UI中的角色,然后单击发送.我正在尝试通过API重建该过程.

I have a client that signs into their DS account, uploads a single 17-page PDF, clicks the action link to the side and selects "Apply Template". The template contains tabs and roles. They fill in the roles in the DS UI and click send. I am attempting to rebuild that process via API.

我发现这看起来很适合我的情况:

I found this that looks like it should work for exactly my scenario: How do I apply a template to a document using Docusign REST API

我得到一个包含34页的信封:原始的17页上载的PDF和模板中的17页.模板正在添加还是已应用.

I am getting an envelope with 34 pages instead: the original 17-page uploaded PDF and the 17 pages from the template. The template is being added vs. applied.

模板的文档确实被拆分了(例如,一个带有两个标签的4页文档,一个带有1个标签的1页文档,等等,总共17页).通过UI可以很好地工作,因此不确定是否会影响任何事情.

The template does have its documents split out (e.g., a 4 page document with two tabs, a 1 page document with 1 tab, etc. total 17 pages). It works great through the UI so not sure if this affects anything.

如何上传PDF并将模板应用到文档?

How do I upload the PDF and apply the template to the document?

这是我的请求有效载荷:

Here is my request payload:

POST https://demo.docusign.net/restapi/v2/accounts/ACCTNMBR/envelopes HTTP/1.1
Accept: application/json
Content-Type: multipart/form-data; boundary=myboundary


--myboundary
Content-Type: application/json
Content-Disposition: form-data

{
  "emailBlurb": "Test Envelope Blurb",
  "emailSubject": "Test Envelope Subject",
  "status": "created",
  "signingLocation": "Online",
  "compositeTemplates": [
  {
    "document": {
      "documentId": 1,
      "name": "UPLOADED.pdf"
    },
    "inlineTemplates": [{
      "sequence": "1",
      "recipients": {
        "signers": [{
          "email": "jane.doe@example.com",
          "name": "Jane Doe",
          "recipientId": "1",
          "roleName": "Signer1",
          "clientUserId": "123"
        }]
      }
    }]
  },
  {
    "serverTemplates": [{
      "sequence": "1",
      "templateId": "TEMPLATE_ID"
    }]
  }]
}

--myboundary

Content-Type: application/pdf
Content-Disposition: file; filename="UPLOADED.pdf"; documentid=1

PDF_BYTES_HERE

--myboundary--

推荐答案

最终的答案是使用草稿格式的上载文档创建一个信封.然后将模板应用于信封的文档,而不是信封本身或使用复合模板.

The end answer was to create an envelope with the uploaded document in draft form. Then apply a template to the document of the envelope instead of to the envelope itself or using composite templates.

POST https://demo.docusign.net/restapi/v2/accounts/ACCTNMBR/envelopes/ENVELOPEID/documents/1/templates HTTP/1.1
Accept: application/json
Content-Type: application/json

{
  "documentTemplates": [{
    "documentId": "1",
    "templateId": "TEMPLATE_ID",
    "documentStartPage": "1",
    "documentEndPage": "15"
  }]
}

这篇关于如何在DocuSign API中将服务器模板应用于信封文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆