0

Trying to call the Docusign REST API to Delete/Close User. Passing XML as the documentation in Docusign accepts XML or JSON. But getting 400 status code. I can login using REST API fine. Have had several eyes look at Docusign documentation on the Delete in relation to what I'm passing in XML, but nothing has popped out as to why we are getting 400. Typically, that would mean your XML ... your request is not correct format. Is anyone having this issue with Delete/Close User? Any advice?

Bobby
  • 1
  • 2
  • Possible duplicate of [Why is my WCF web service presenting this object in a different namespace with different field names?](http://stackoverflow.com/questions/20686436/why-is-my-wcf-web-service-presenting-this-object-in-a-different-namespace-with-d) – Pavel Pája Halbich Jul 12 '16 at 12:35
  • 1
    Show some of your code or working out you are trying to do, will help to answer the question – deeveeABC Jul 12 '16 at 12:40
  • body = "" + "" + "" + "" + t + "" + "" + "" + ""; – Bobby Jul 12 '16 at 12:53
  • connection = InitializeRequest(url, "DELETE", body, getAuthenticationHeader()); – Bobby Jul 12 '16 at 12:54
  • first, I do a login call first come back and have the base URL then append "/users" to it. – Bobby Jul 12 '16 at 12:54
  • My initializeRequest method - conn = (HttpURLConnection)new URL(url).openConnection(); conn.setRequestMethod(method); conn.setRequestProperty("X-DocuSign-Authentication", httpAuthHeader); – Bobby Jul 12 '16 at 12:56
  • ... conn.setRequestProperty("Accept", "application/json"); conn.setRequestProperty("Content-Type", "application/xml"); – Bobby Jul 12 '16 at 12:56
  • My getAuthenticationHeader method -> String header = "" + "" + username + "" + "" + password + "" + "" + integratorKey + "" + ""; – Bobby Jul 12 '16 at 12:57
  • after I append "/users" to base url it looks like this (xxxxxxx) is the account number but I x'd it out for security purposes. "Demo" is the test / dev area. https://demo.docusign.net/restapi/v2/accounts/xxxxxxx/users – Bobby Jul 12 '16 at 13:08
  • Do you have any suggestions based on my code? – Bobby Jul 12 '16 at 13:49
  • I figured it out. Had to add this to my java coding. – Bobby Jul 12 '16 at 18:43
  • conn.setRequestProperty("Content-Type", "application/xml"); conn.setRequestProperty("Content-Length", Integer.toString(body.length())); // write body of the POST request DataOutputStream dos = new DataOutputStream( conn.getOutputStream() ); dos.writeBytes(body); dos.flush(); dos.close(); – Bobby Jul 12 '16 at 18:43
  • body is the xml string you see above – Bobby Jul 12 '16 at 18:44

1 Answers1

0

Please don't use legacy authentication as it's old and insecure.

You should be using OAuth and if you don't want to have to authenticate each user you can use JWT (JSON Web Token) which would require that you obtain consent for the app to impersonate the user (or any user) that they make API calls on their behalf. You can find more information about how to use JWT Auth in this article on the DocuSign developer center.

Deleting a user using the REST API is done using this endpoint:

DEL
/restapi/v2.1/accounts/{accountId}/users

The body is a JSON with an array of one or more users to delete. The userId (GUID) is sufficient information to provide to delete a user.

Inbar Gazit
  • 12,566
  • 1
  • 16
  • 23