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

1
+1
-1

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

Comments

Submitted by ttoine on Thu, 01/09/2014 - 16:18

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

Submitted by aCordier on Thu, 01/09/2014 - 16:21

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

Thanks

Antoine

Submitted by ttoine on Thu, 01/09/2014 - 16:24

Let me check

Submitted by anthony.birembaut on Thu, 01/09/2014 - 16:47

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}

Submitted by ttoine on Thu, 01/09/2014 - 16:52

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

Submitted by anthony.birembaut on Thu, 01/09/2014 - 17:34

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.

Submitted by aCordier on Thu, 01/09/2014 - 17:38

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

Submitted by anthony.birembaut on Thu, 01/09/2014 - 18:06

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

Submitted by aCordier on Thu, 01/09/2014 - 20:20

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.

Submitted by aCordier on Fri, 01/10/2014 - 11:28

It works, thanks!

Submitted by christine.mckinty on Tue, 01/14/2014 - 11:41

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

Chris

1 answer

1
+1
-1

You can read information about it on the documetation:

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

Notifications