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

DELETE API requests do not pass body entity #154

Closed adammcdonagh closed 4 years ago

adammcdonagh commented 4 years ago

Hi, It appears that any calls to DELETE endpoints do not pass any body in the request. This causes issues with the SigningGroups::deleteUsers endpoint for example, where the body of the request needs to be the list of users that are being deleted. - As detailed here: https://developers.docusign.com/esign-rest-api/reference/SigningGroups/SigningGroupUsers/delete#examples

https://github.com/docusign/docusign-java-client/blob/f3bd647f29984f28bb92bd8335ae1f10fc56cc6b/src/main/java/com/docusign/esign/client/ApiClient.java#L1362

As is, this call to the API produces the following output:

List<SigningGroupUser> toRemove = new ArrayList();
toRemove.add(sgUser);
sgApi.deleteUsers(accountId, sg.getSigningGroupId(),
        new SigningGroupUsers()
                .users(toRemove)
);
INFO: 3 * Sending client request on thread main
3 > DELETE https://demo.docusign.net/restapi/v2.1/accounts/10856831/signing_groups/527240/users
3 > Accept: application/json
3 > Authorization: Bearer <REDACTED>
3 > User-Agent: Swagger-Codegen/3.7.0-BETA/java

Jul 27, 2020 2:16:32 PM org.glassfish.jersey.logging.LoggingInterceptor log
INFO: 3 * Client response received on thread main
3 < 400
3 < Cache-Control: no-cache
3 < Connection: keep-alive
3 < Content-Length: 101
3 < Content-Type: application/json; charset=utf-8
3 < Date: Mon, 27 Jul 2020 13:16:38 GMT
3 < Vary: Accept-Encoding
3 < Via: 1.1 hosted.websense 06a
3 < X-Bst-Info: t=1595855798,h=06a,p=5872_16811:2_12011,c=2339,v=7.10.72680.242
3 < X-Bst-Request-Id: QH9Mqj:Cdpc:139797
3 < X-DocuSign-Node: DA2DFE6
3 < X-DocuSign-TraceToken: dbefb9ec-56a0-41ed-9090-a241f0de85ca
{"errorCode":"INVALID_REQUEST_BODY","message":"The request body is missing or improperly formatted."}

As you can see, there is no content being sent.

adammcdonagh commented 4 years ago

Investigating further, it looks like Jersey 2 doesn't allow entities in the request body anyway....

mmallis87 commented 4 years ago

@adammcdonagh thank you for trying out this beta version! You're right Jersey2 Invocation.Builder doesn't support request body in delete methods and unfortunately this DocuSign API requires it.

I'm working on a fix that should go out as part of 3.8.0-BETA release that is coming out in the next days.

Until then if you wan more details about the bug you can look at Swagger Codegen Jersey2 template.

c.c. @gsnavin

mmallis87 commented 4 years ago

@adammcdonagh I fixed this issue in 3.8.0-BETA and added a real test case for that. Is it possible to upgrade to it and double-check on your end?

mmallis87 commented 4 years ago

Version 3.8.0 has been just released. Please upgrade to get the fix.