DocuSign API替换模板文档但保留字段 [英] DocuSign API Replace template document but keep fields

查看:52
本文介绍了DocuSign API替换模板文档但保留字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在另一个文档上使用服务器模板中的现有字段。

I want to use the existing fields from a server template over another document.

首先,我尝试将文档附加到内联/服务器的同一级别。
如果我定义了签名者,它会给我400错误,如果我将其保留(是偶然地),它会彻底清除字段并显示随附的文档。

At first I tried attaching the document at the same level as inline/server. If I have the signer defined it gives me a 400 error, if I leave it off (did by accident) it completely wipes out the fields and shows the attached document.

第二,我尝试将文档附加到内联模板,但这导致附加的文档不显示,它的运行方式与正常一样。

Second I tried attaching the document to the inline template but that results in the attached document not appearing, it just operates like normal.

update

添加其他调试和研究后,我现在知道将其附加到嵌入式模板是不正确的。添加调试以读取400响应后,出现此错误:

After adding additional debugging and research I now know that attaching it to the inline template was incorrect. After adding debug to read the 400 response I am getting this error:


在tab元素中指定的DocumentId并不引用文档在此信封中,制表符引用了不存在的DocumentId 32475214。

"The DocumentId specified in the tab element does not refer to a document in this envelope. Tab refers to DocumentId 32475214 which is not present."

DocumentId设置为1,这显然是错误的。

DocumentId is being set to 1 which is apparently wrong.

这使我想到了。其中有一条评论提到应使用从400踢回的ID。
对这个ID进行硬编码后,我看到替换操作成功了!

Which led me to this question on SO. In which a comment mentions that the ID kicked back from the 400 should be used. After I hard coded this ID I see the replacement operation is a success!

但是我现在需要找到一种查找方法,并以编程方式将该值插入。

However I now need to find a way find and to plug that value in programatically.

详细信息

我正在使用DocuSign php sdk 来帮助我建立数据结构并访问api。

I am using the DocuSign php sdk to help me build the data structure and access the api.

推荐答案

使用 listTemplateDocuments API来检索模板的documentId。

Use the listTemplateDocuments API to retrieve the documentId for the template.

在上述步骤中检索到的 documentId 应该在< a href = https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/create/ rel = nofollow noreferrer> CreateEnvelope 请求

The documentId retrieved in the above step should be used in the CompositeTemplate of CreateEnvelope request

{
  "emailSubject": "Tabs should remain from the Server Template",
  "status": "sent",
  "compositeTemplates": [
    {
      "document": {
            "documentId": "<document Id>", //Use the documentId retrieved using the listTemplateDocuments api
            "name": "Replaced Document",
            "fileExtension": "txt",
            "documentBase64": "RG9jIFRXTyBUV08gVFdP"
        },
        "serverTemplates": [
            {
                "sequence": "1",
                "templateId": "<Server Template Id Here>"
            }
        ]
    }
  ]
}

这篇关于DocuSign API替换模板文档但保留字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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