简体   繁体   English

将文档添加到现有DocuSign信封的正确请求格式是什么?

[英]What is the proper request format for adding a document to an existing DocuSign envelope?

To add a document to an existing draft DocuSign envelope, it seems as though one makes a multipart PUT call to /accounts/{accountId}/envelopes/{envelopeId}/documents (see this page ). 要将文档添加到现有的DocuSign草稿信封中,似乎可以对/ accounts / {accountId} / envelopes / {envelopeId} / documents进行多部分PUT调用(请参阅本页 )。

In the example on the site, I see one form part that defines the data that will be sent (ie document names and IDs), and remaining parts have the documents themselves. 在该站点的示例中,我看到一个表单部分,该部分定义了将要发送的数据(即文档名称和ID),其余部分具有文档本身。

The example is only provided in JSON format, whereas I am using XML. 该示例仅以JSON格式提供,而我正在使用XML。 I suspect that I am missing something when I infer the format due to JSON being less verbose. 我怀疑在推断格式时会丢失一些内容,因为JSON不太冗长。

When I make my request, I get a response stating that something is wrong, but doesn't give me quite enough information to rectify it: 当我提出请求时,我得到一个响应,指出有问题,但没有提供足够的信息来纠正它:

<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><errorCode>INVALID_MULTI_PART_REQUEST</errorCode><message>An error was found while parsing the multipart request. The XML request does not match the expected format. </message></errorDetails>

Here is the body of the request I am making (with the document truncated) 这是我正在发出的请求的正文(文档被截断)

--mq1mFxUoPiKbAACz7JGKBlpTp1SsHEu5O
Content-Disposition: form-data
Content-Type: application/xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><documents xmlns="http://www.docusign.com/restapi"><document><name>fw4.pdf</name><documentId>2</documentId></document></documents>
--mq1mFxUoPiKbAACz7JGKBlpTp1SsHEu5O
Content-Disposition: file; filename="fw4.pdf"; documentId=2
Content-Type: application/pdf

%PDF-1.7
(etc.)
%%EOF

--mq1mFxUoPiKbAACz7JGKBlpTp1SsHEu5O--

I believe what I need is the proper format of the XML portion of the request. 我相信我需要的是请求的XML部分的正确格式。

I believe you still need to have the <envelopeDefinition></envelopeDefinition> tabs in your XML body. 我相信您仍然需要在XML主体中具有<envelopeDefinition></envelopeDefinition>选项卡。 Try this: 尝试这个:

<envelopeDefinition xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.docusign.com/restapi">
    <documents>
        <document>
        <name>fw4.pdf</name>
        <documentId>2</documentId>
        </document>
    </documents>
</envelopeDefinition> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM