我有一个客户登录他们的DS帐户,上传一个17页的PDF,点击侧面的操作链接并选择“应用模板”。该模板包含选项卡和角色。他们在DS UI中填写角色,然后单击“发送”。我试图通过API重建该过程。
我发现这看起来应该适用于我的情景:How do I apply a template to a document using Docusign REST API
我收到一个34页的信封:原始的17页上传的PDF和17页的模板。正在添加模板与应用模板。
模板确实将其文档拆分出来(例如,带有两个标签的4页文档,带有1个标签的1页文档,总共17页)。它在UI中运行良好,因此不确定这是否会影响任何内容。
如何上传PDF并应用模板到文档?
这是我的请求有效负载:
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--
答案 0 :(得分:1)
您发布的请求是创建两个复合模板。第一个包含您上传的PDF并定义您的签名者,而第二个包含您的服务器端模板的内容。解决方案是仅定义一个复合模板。这将导致您上传的PDF,内联模板和服务器端模板全部合并。 E.g:
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": "2",
"templateId": "TEMPLATE_ID"
}]
}]
}
--myboundary
Content-Type: application/pdf
Content-Disposition: file; filename="UPLOADED.pdf"; documentid=1
PDF_BYTES_HERE
--myboundary--
要注意的几件事情:
答案 1 :(得分:1)
最终答案是以草稿形式创建包含上传文档的信封。然后将模板应用于信封的文档,而不是信封本身或使用复合模板。
<div class="fb-page" data-href="https://www.facebook.com/facebook" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true" data-show-posts="true"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/facebook"><a href="https://www.facebook.com/facebook">Facebook</a></blockquote></div></div>