docusign-esign-ruby-client icon indicating copy to clipboard operation
docusign-esign-ruby-client copied to clipboard

envelope_api update_document not working as expected

Open MorneL opened this issue 1 year ago • 1 comments

Hi there,

I'm trying to add a new document to my envelope using update_document, however I'm unsure of what to pass in for the document_file_bytes. The documentation is quite vague. I've tried just passing in the bytes, I've tried passing in base 64 encoded bytes and I've tried passing in a DocuSign_eSign::Document.

All of these return the same error The request contained at least one invalid parameter. A filename was not found in the Content-Disposition header ('filename=\\\"filename.ext\\\"\"}

Passing in the bytes doesn't give me an option to set the content-disposition header anywhere. I would've expected to have to pass in a DocuSign_eSign::Document at this point rather as it gives the option to attach the filename etc..

For now I've resolved this by using update_documents and just passing in one document. However I'd like to use update_document as I expect it's probably a less expensive call.

MorneL avatar Apr 05 '24 12:04 MorneL

Hey @MorneL, document_file_bytes value is the equivalent of byte[] from a file. We can use File.open to read the file bytes (binary information)

file = File.open("filename.ext", "rb")
contents = file.read

This is most likely similar to how you passed it as bytes.

Content-Disposition can be declared either on instantiating via api_client.default_headers (i.e. api_client.default_headers['Content-Disposition'] = "filename=\"filename.ext\"") or api_client.header_params['Content-Disposition'] = "filename=\"filename.ext\"" instanced.

Try referring to the HTTP request build for the api_client class for more information: https://github.com/docusign/docusign-esign-ruby-client/blob/b35d45eb7870273a9fb7b87de198062553ba34f9/lib/docusign_esign/client/api_client.rb#L88

AliceGoglione-DS avatar Apr 09 '24 19:04 AliceGoglione-DS

@MorneL I hope this issue is resolved for you. Closing this issue from our side. Please feel free to reopen it if you feel resolution is not good enough.

asif-docusign avatar May 21 '24 05:05 asif-docusign