1
votes

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:

  1. I am creating envelope(without documents) in the first POST API call(https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes)
  2. 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})
  3. 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."
}
2
Silly question, but are you sure you're setting your {ext} parameter to docx so that your content-disposition header has fileExtension=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
Hi Drew, Provided the log details for docx. FYI, Getting success response for pdf file upload. - Arun Kumar

2 Answers

0
votes

Few things to check:

  1. Does this happen with any word document or just a specific one?
  2. Can you upload the same Word document directly to DocuSign web app and it works fine?
  3. how large is the file in question? Is it possible it's still over 25M?
  4. Consider using binary file transfer. Here is an example of code showing you how to do this:

https://developers.docusign.com/esign-rest-api/code-examples/code-example-send-binary

0
votes

You can use multi-part mime encoding of the envelope with the individual files either BASE64 encoded or sent in binary format.

Check that you're using binary format and that the entire request to DocuSign is not over 25 MB.

Download and run a version of the eg-03- example software repository for your favorite language. These repos are stored in github.com/docusign they are documented here: https://developers.docusign.com/esign-rest-api/code-examples/code-example-send-binary.

Within the example code, workflow #10 shows how to send in binary mode. The example sends a Word document so you can substitute your own to check that it works ok.