There's no bulk operations available yet I'm afraid

On 27 June 2016 at 14:51, Haim Vana <haimv@perfectomobile.com> wrote:

Thanks – it will work.

 

I wonder if they have bulk operations in the API, for example for deleting all users, now I have to get all of them and delete them one by one.

 

From: Thomas Darimont [mailto:thomas.darimont@googlemail.com]
Sent: Monday, June 27, 2016 3:49 PM
To: Haim Vana <haimv@perfectomobile.com>
Cc: keycloak-user@lists.jboss.org
Subject: Re: [keycloak-user] Listing all realm users programmatically

 

Hello Haim,

 

I think the following does what you are look for.

 

int pageIndex = 0;

int pageSize = 1000;

String realmName = "master";

 

List<UserRepresentation> results =  keycloak.realm(realmName).users().search(null, null, null, null, pageIndex * pageSize, pageSize)

 

where Keycloak is org.keycloak.admin.client.Keycloak.

 

Cheers,

Thomas

 

2016-06-27 11:59 GMT+02:00 Haim Vana <haimv@perfectomobile.com>:

Hi,

 

Is there a way to list all realm users programmatically via the API ? also is there a way to delete all of them ?

 

I think I should use the below, however what should I insert in the search method for getting all the users ?

 

keyCloakClient.realms().realm(realmName).users().search()

 

 

Thanks,

Haim.

 

The information contained in this message is proprietary to the sender, protected from disclosure, and may be privileged. The information is intended to be conveyed only to the designated recipient(s) of the message. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.


_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user

 

The information contained in this message is proprietary to the sender, protected from disclosure, and may be privileged. The information is intended to be conveyed only to the designated recipient(s) of the message. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.

_______________________________________________
keycloak-user mailing list
keycloak-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/keycloak-user