docusign / docusign-esign-java-client

The Official Docusign Java Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://javadoc.io/doc/com.docusign/docusign-esign-java/latest/index.html
MIT License
105 stars 96 forks source link

EnvelopesApi "liststatus" and "listStatusChanges" produce "400 BAD REQUEST" errors #156

Open mkornblum opened 4 years ago

mkornblum commented 4 years ago

Hello!

The following code always produces a 400 error:

EnvelopeIdsRequest request = new EnvelopeIdsRequest();
request.setEnvelopeIds(incompleteEnvelopeIds);

EnvelopesInformation envelopesInformation = envelopesApi
     .listStatus(accountId, request);
com.docusign.esign.client.ApiException: Error while requesting server, received a non successful HTTP code 400 with response Body: '{
  "errorCode": "INVALID_REQUEST_PARAMETER",
  "message": "The request contained at least one invalid parameter. Query parameter 'from_date' must be set to a valid DateTime, or 'envelope_ids' or 'transaction_ids' must be specified."
}'

From tracking this through the java client guts with the debugger, it looks to me like the EnvelopeIdsRequest is not getting properly serialized and not included with the request. It's there in the Docusign client code, but somewhere in Jersey it doesn't get written when the PUT is actually executed.

I wonder if this may be a similar underlying issue to https://github.com/docusign/docusign-java-client/issues/154? I also noticed a couple of comments from this past May on an old issue documenting the same problem: https://github.com/docusign/docusign-java-client/issues/76

I have tried this with both 2.15 and 3.6 of the Docusign client and had the same issue with both of them.

Thanks for any assistance!

Mark

mkornblum commented 4 years ago

Also, if I do this:

EnvelopeIdsRequest request = new EnvelopeIdsRequest();
request.setEnvelopeIds(incompleteEnvelopeIds);

EnvelopesApi.ListStatusOptions listStatusOptions = envelopesApi.new ListStatusOptions();
listStatusOptions.setEnvelopeIds("request_body");
EnvelopesInformation envelopesInformation = envelopesApi.listStatus(accountId, request, listStatusOptions);

Then it works. However, the third param I believe is documented as being optional as things stand (at least in 2.15) and it feels kind of counter intuitive to be required to pass configuration in an optional third param in order to make the second param work.

(I pulled the code from looking at the unit tests associated with this ;) )

LarryKlugerDS commented 4 years ago

Good job on solving the problem. The docs could certainly be clearer. I've filed DEVDOCS-3131 to improve them. Thank you for raising this issue.

fortuneFelix commented 3 years ago

Wow! This is definitely an interesting one! I suggest to fix the API not the docs. This would have taken me days to work that out, I'm so glad I found this issue! In the docs there should be a warning or some example showing that this is required!