Since DocuSign API have limitations on the max size of 25 MB per request, we have to split our envelope creation into multiple request, initially the envelope will be created as draft. Then the documents will be updated to the same envelope using envelope Documents update call.
However we are getting a 'FORMAT_CONVERSION_ERROR' error for each Word doc I add using multi part request. PDF docs can be added successfully
"errorDetails": {
"errorCode": "FORMAT_CONVERSION_ERROR",
"message": "The data could not be converted."
}
Is there a work around to make it work for multi-part request?
Here are the steps I followed:
- I am creating envelope(without documents) in the first POST API call(https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes)
- Adding documents(both pdf and docx) to the envelope (multipart method) by making PUT API call for each document(https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes/{envelopeId}/documents/{docId})
- Only PDF files are uploaded to the docusign, whereas getting 400 error "FORMAT_CONVERSION_ERROR - The data could not be converted" error for docx type file upload
I am adding this header "Content-Disposition", "file; filename={filename};fileExtension={ext};documentId={id}"
Any suggestion/solution will be appreciated.
Log details:
PUT https://demo.docusign.net:7801/restapi/v2/accounts/{myaccountid}/envelopes/{myenvelopeid}/documents/1
TraceToken: d0d9eae1-01d3-4c56-928d-da38a7ac30fc
Timestamp: 2020-01-09T08:48:52.7616114Z
Content-Type: multipart/form-data; boundary=LV-qEHBRJq6zprmD52mUZfeNsrT5alHGfkE8w
Content-Disposition: file; filename=MyTemplate.docx; fileExtension=docx; documentId=1
Content-Length: 12998
Connection: Keep-Alive
Transfer-Encoding: chunked
Authorization: bearer [omitted]
Expect: 100-continue
Host: demo.docusign.net
User-Agent: Apache-HttpClient/4.0.3(java 1.5)
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384
x-forwarded-for: 106.51.84.53
--LV-qEHBRJq6zprmD52mUZfeNsrT5alHGfkE8w
Content-Disposition: form-data; name="MyTemplate.docx"; filename="MyTemplate.docx"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
//Some binary data here.
--LV-qEHBRJq6zprmD52mUZfeNsrT5alHGfkE8w--
400 BadRequest
Content-Type: application/json; charset=utf-8
Content-Length: 96
X-DocuSign-TraceToken: d0d9eae1-01d3-4c56-928d-da38a7ac30fc
{
"errorCode": "FORMAT_CONVERSION_ERROR",
"message": "The data could not be converted."
}
docxso that your content-disposition header hasfileExtension=docx? You might use DocuSign API logging (support.docusign.com/en/guides/…) to capture the failing call and confirm exactly what your application is sending to the DS API. - Drew