Error creating DocuSign Envelope via DocuSign Rest API (with multiple documents and multiple recipients)

天涯浪子 提交于 2019-12-19 11:25:20

问题


I am trying to create an Envelope in DocuSign with multiple documents using the DocuSign REST API, I'm using a multipart/form-data request, I use JSON to define the attributes of the envelope, I check my JSON and I think it is OK. Below that I define a multipart/mixed section where I set the header and PDF bytes of the documents. I receive a Bad Request error code that said "NO_DOCUMENT_RECEIVED" and have as message "The document element did not contain the encoded document, or there is a problem with the encoding. ". I post the request result from fiddler below:

// Request

POST https://demo.docusign.net/restapi/v2/accounts/295724/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"email","Password":"password","IntegratorKey":"key"}
Content-Type: multipart/form-data; boundary=9a56da749dc04804819460f6499ab80b
Accept: application/json
Host: demo.docusign.net
Content-Length: 31476
Expect: 100-continue

--9a56da749dc04804819460f6499ab80b
Content-Type: application/json
Content-Disposition: form-data

{"emailBlurb":"EMAIL BODY HERE OK OK","emailSubject":"EMAIL SUBJECT HERE IS MANDATORY","status":"sent","documents":[{"documentId":1,"name":"ABC.pdf"},{"documentId":2,"name":"AB.pdf"}],"recipients":{"signers":[{"email":"dn@brenock.com","name":"Dubhe","recipientId":"1","routingOrder":"1"},{"email":"dubhe.dnacimiento@gmail.com","name":"DubheF","recipientId":"2","routingOrder":"1"}]}}
--9a56da749dc04804819460f6499ab80b
Content-Disposition: form-data
Content-Type: multipart/mixed; boundary=e8bc9555e9634110bba63547b2552460

--e8bc9555e9634110bba63547b2552460
Content-Type: application/pdf
Content-Disposition: file; filename=ABC.pdf; documentId=1

<PDF Bytes Document 1>
--e8bc9555e9634110bba63547b2552460
Content-Type: application/pdf
Content-Disposition: file; filename=AB.pdf; documentId=2

<PDF BytesDocument Two>
--e8bc9555e9634110bba63547b2552460--
--9a56da749dc04804819460f6499ab80b--

回答1:


You shouldn't need these lines that define a second boundary (or any of the subsequent references to that second boundary):

Content-Disposition: form-data
Content-Type: multipart/mixed; boundary=e8bc9555e9634110bba63547b2552460

Try removing that (and all subsequent references to boundary e8bc9555e9634110bba63547b2552460), so that your request looks like this:

POST https://demo.docusign.net/restapi/v2/accounts/295724/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"email","Password":"password","IntegratorKey":"key"}
Content-Type: multipart/form-data; boundary=9a56da749dc04804819460f6499ab80b
Accept: application/json
Host: demo.docusign.net
Content-Length: 31476
Expect: 100-continue

--9a56da749dc04804819460f6499ab80b
Content-Type: application/json
Content-Disposition: form-data

JSON_REQUEST_BODY_HERE
--9a56da749dc04804819460f6499ab80b
Content-Type:application/pdf
Content-Disposition: file; filename="ABC.pdf"; documentid=1 

DOCUMENT_1_BYTES_HERE
--9a56da749dc04804819460f6499ab80b
Content-Type:application/pdf
Content-Disposition: file; filename="AB.pdf"; documentid=2 

DOCUMENT_2_BYTES_HERE
--9a56da749dc04804819460f6499ab80b--


来源:https://stackoverflow.com/questions/20510141/error-creating-docusign-envelope-via-docusign-rest-api-with-multiple-documents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!