我们正在尝试使用docusign restapi v2从pdf文档创建信封。我们可以使用XML创建一个信封,但是当我们尝试使用JSON时,我们会从docusign收到以下错误。
"errorCode": "ENVELOPE_IS_INCOMPLETE",
"message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Envelope definition missing."
我们发送的整个POST都来自fiddler(删除了文件内容)。
POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}
Content-Type: multipart/form-data; boundary=AAA
Accept: application/json
Host: demo.docusign.net
Content-Length: 90500
Expect: 100-continue
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"emailBlurb": "Blurb",
"emailSubject": "Subhject",
"documents": [
{
"name": "NDA.pdf",
"documentId": "1"
}
],
"recipients": {
"signers": [
{
"tabs": {
"signHereTabs": [
{
"pageNumber": "1",
"yPosition": "1",
"xPosition": "1",
"documentId": "1",
"tabId": "1",
"name": "TabName"
}
]
},
"routingOrder": "1",
"recipientId": "1",
"name": "Ben",
"email": "ben@test.com"
}
]
},
"status": "created"
}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="NDA.pdf"; documentId="1"
<pdf file image content goes here>
--AAA--
据我所知,JSON看起来是正确的。我们在这里缺少什么错误?
答案 0 :(得分:1)
您的JSON看起来不错,这可能是因为您在请求正文中有一个或多个CRLF字符分隔您的边界。一般来说,这是需要间隔的方式(每个换行符是 \ r \ n ):
--AAA
Content-Type: application/json
Content-Disposition: form-data
<YOUR VALID JSON GOES HERE>
--AAA
Content-Type:application/pdf
Content-Disposition: file; filename="document.pdf"; documentid=1
<DOCUMENT BYTES GO HERE>
--AAA--
您的文档字节后面的额外换行很可能导致您的问题。
答案 1 :(得分:0)
我有同样的问题症状。
我的问题出在&#34;边界终结者&#34;。一定要使用:
--AAA
Content-Type: application/json
Content-Disposition: form-data
<YOUR VALID JSON GOES HERE>
--AAA--
如果你的多部分附件中没有文件