Docusignapi Docusign API复合模板

Docusignapi Docusign API复合模板,docusignapi,docusigncompositetmplts,Docusignapi,Docusigncompositetmplts,我试图使用compositeTemplate创建一个包含收件人信息和用户提供的文档的信封。创建信封时,不会将收件人信息或文档添加到信封中。然而,信封使用服务器模板部分中提供的模板。bytestring变量是pdfbytes。我正在使用RESTAPI。下面是我的xml字符串。感谢您的帮助 12月9日编辑,原始结果相同。 另外,我已经成功创建了一个信封,其中包含提供的pdf字节,但不使用任何模板 <envelopeDefinition xmlns="http://www.docusign.co

我试图使用compositeTemplate创建一个包含收件人信息和用户提供的文档的信封。创建信封时,不会将收件人信息或文档添加到信封中。然而,信封使用服务器模板部分中提供的模板。bytestring变量是pdfbytes。我正在使用RESTAPI。下面是我的xml字符串。感谢您的帮助

12月9日编辑,原始结果相同。 另外,我已经成功创建了一个信封,其中包含提供的pdf字节,但不使用任何模板

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
            ...
            <compositeTemplates>
                <compositeTemplate>
                    <serverTemplates>
                       ...
                    </serverTemplates>
                    <inlineTemplates>
                       ...
                    </inlineTemplates>
                    <document>
                        <name>DOCUSIGN API TEST DOC</name>
                        <documentId>123456</documentId>
                        <documentBase64>pdfbytestring</documentBase64>
                    </document>
                </compositeTemplate>
            </compositeTemplates>
        </envelopeDefinition>

...
...
...
DOCUSIGN API测试文档
123456
pdfbytestring

PDFBytes在DocuSign REST API中不是文档的有效属性--在中没有提到该属性。(它是SOAP API中的一个有效属性,但您没有使用SOAP API。)这可能就是DocuSign没有将文档添加到信封中的原因——它无法识别PDFBytes属性,因此它只是忽略它

您可以尝试使用documentBase64属性(而不是PDFBytes

除了使用documentBase64属性(而不是PDFBytes),我还建议您重新访问XML请求结构——如果您希望信封包含API请求中指定的文档(而不是模板中的文档),那么您的请求的结构应该如下所示:

(此处仅显示请求的compositeTemplates部分):


...
...
文件名
文件ID
文件字节

换句话说,将节点作为inlineTemplates节点和serverTemplates节点的对等元素,并将封装的元素全部移除(如上面的示例所示)。

那么问题出在哪里?你收到错误消息了吗?如果是,它说什么?请详细说明……问题是,创建时提供的文档未包含在信封中。通过服务器模板标记提供的模板显示正确。没有错误消息,它只是用给定的模板创建信封,而不是文档。在这种情况下,您知道RESTAPI中使用的正确属性是什么吗?此外,如果我在内联模板中包含PDFBytes属性,但没有为文档名提供name属性,我确实会收到一个错误,说明“在未设置“name”字段的情况下定义了文档”。使用可能的解决方法更新了我的答案--尝试改用documentBase64属性。我们也尝试使用该属性,但未能显示正确的文档。Kim,我尝试对xml结构进行建议的更改,并得到了相同的结果。请参阅我对当前xml结构的原始帖子的编辑。
<compositeTemplates>
  <compositeTemplate>
      <serverTemplates>
        <serverTemplate>
            ...
        </serverTemplate>
      </serverTemplates>
      <inlineTemplates>
        <inlineTemplate>
            ...
        </inlineTemplate>
      </inlineTemplates>        
      <document>
        <name>DOCUMENT_NAME</name>
        <documentId>DOCUMENT_ID</documentId>
        <documentBase64>DOCUMENT_BYTES</documentBase64>
      </document>
  </compositeTemplate>
</compositeTemplates>