docusign / docusign-esign-ruby-client

The Official DocuSign Ruby Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
MIT License
66 stars 62 forks source link

updateDocument methods missing the document as part of payload body #110

Open GlauberrBatista opened 2 years ago

GlauberrBatista commented 2 years ago

According to the API documentation we need to pass the document in the body of the request. However, the method does not allow us to provide the document definition.

On the other side, the update_documents method allow us to provide the envelope definition and the documents definition by consequence.

The request made by the first method includes a nil body and for the second one, the body is populated with the envelope definition.

I don't think this is the correct behavior but if it is, how can I upload a document first and then attach it to the envelope?

Edit: Fix links

Malstrom commented 1 year ago

Yes, i need this feature but is not present in gem

asif-docusign commented 1 month ago

Sorry for the inconvenience. This issue is fixed in latest stable SDK. Please check and let us know if this is what you want.

GlauberrBatista commented 1 month ago

Sorry for the inconvenience. This issue is fixed in latest stable SDK. Please check and let us know if this is what you want.

Hey @asif-docusign thanks for getting back, but unfortunately, it's still not working.

This is the response I'm getting:

{"errorCode":"INVALID_REQUEST_PARAMETER","message":"The request contained at least one invalid parameter. A filename was not found in the Content-Disposition header (''filename=\"filename.ext\""}

I tried to use both binary and base64 encoded content and got the same result. I'm assuming it would be necessary a way to set the Content-Disposition header when invoking the method.

These are the request headers I got when recording my tests VCRs, there is no Content-Disposition header:

headers:
  User-Agent:
  - Swagger-Codegen/v2.1/4.0.0/ruby-3.3.0p0
  Content-Type:
  - application/pdf
  Authorization:
  - Bearer TOKEN
  Accept:
  - application/json
  X-Docusign-Sdk:
  - Ruby
  Expect:
  - ''

It also doesn't seem the method sets the headers https://github.com/docusign/docusign-esign-ruby-client/blob/840c028d3d59300a0a4b32cb1646a7bf49161c6b/lib/docusign_esign/api/envelopes_api.rb#L6315-L6357

I have a monkey patch in my repo that uses a document definition instead and it's working that way. Is it possible to implement it in that form? It mimics the update_documents_with_http_info https://github.com/docusign/docusign-esign-ruby-client/blob/840c028d3d59300a0a4b32cb1646a7bf49161c6b/lib/docusign_esign/api/envelopes_api.rb#L6494-L6530

If it's not possible to implement it using a document definition, then there should be a way to pass the file name too.

GlauberrBatista commented 1 month ago

I said document definition but it doesn't seem that term exists on DocuSign. It would be an attachment actually, with the same payload used to attach a document to an envelope. We are doing it that way in the update endpoint, and it works flawlessly.