How to delete a user with Bonita 6.1+ Rest API ?

Hello bonita community,

I am writing a java client for bonita 6.1 rest API using Apache HttpClient 4.3.1

Currently i'm facing a problem with the HTTP DELETE method.

When i want to delete a single entry I execute a httpDelete on http://myserver.com/bonita/API/identity/user/102

102 exists as an id (i can fetch user 102 with a get)

Here is what I end with:

Caused By:(attempt to create delete event with null entity)

By the way, bulk delete relies on a HTTP DELETE accepting a payload and i read here and there that payload support is not guaranted for HTTP DELETE.

Have you got a working example please ?

Thank you,

Antoine

 

 

 

1 Like

You can read information about it on the documetation:

  • 6.1/6.2 -> http://documentation.bonitasoft.com/web-rest-api-details
  • 6.0 -> http://documentation.bonitasoft.com/web-rest-api

Thank you very much aCordier for you question. It helps us improve our resources ;-)

it is possible to deactivate, but not to delete. would it be enough for you

Maybe even better, but how can i achieve this using HTTP ?

Thanks

Antoine

Let me check

Hi,

Although available in the API, deleting users is not advised because the information about who performed some steps / started some case will be lost...

The best solution is to deactivate a user when he is no longer supposed to have access to the platform.

Anyway, to delete a user, you need to perform a DELETE request on API/identity/user with in the request payload ["102"] or ["102","103","104"] if you want to delete several users.

To deactivate a user, you need to perform a PUT request on API/identity/user/102 with in the request payload {enabled:false}

anthony, perhaps it would be good to write an answer with the link the javadoc ?

Actually, this is part of the REST API, not Java API. So the Javadoc is irrelevent. The REST API documentation is here. We will update the part about deleting a resource because it is not accurate.

Hello,

Thank you for pointing that out. Putting the user in the disable state is clearly a better aproach and will definitely suit my purpose.

But when I execute the PUT method with {"enabled":"false"} as a payload what I get as an answer is "...descriptor does not contain field updates". I also made an attempt with {"user_state":"DISABLED"} based on the get response but it does not work that much either.

If i made a put with parameters described in the documentation page, the user is updated as expected.

Do I miss something ?

Thanks

 

 

Which version of Bonita are you using ? The user deactivation feature wasn't present in versions earlier than 6.1.0.

You've got it ! I was running tests on a pretty old server (6.0.x). I'll switch to a 6.2 tomorow and let know here if it made day.

It works, thanks!

The documentation on the WEB REST API has been updated, for 6.0 and 6.1/6.2.

Chris