[keycloak-user] Listing all realm users programmatically

Haim Vana haimv at perfectomobile.com
Mon Jun 27 08:51:37 EDT 2016


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 at googlemail.com]
Sent: Monday, June 27, 2016 3:49 PM
To: Haim Vana <haimv at perfectomobile.com>
Cc: keycloak-user at 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 at perfectomobile.com<mailto:haimv at 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 at lists.jboss.org<mailto:keycloak-user at lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/keycloak-user<https://emea01.safelinks.protection.outlook.com/?url=https%3a%2f%2flists.jboss.org%2fmailman%2flistinfo%2fkeycloak-user&data=01%7c01%7chaimv%40perfectomobile.com%7c98803c82d8774a42632a08d39e8986b0%7cceb4c662d6994e7da0bd272619a46977%7c1&sdata=mwtkqt04R%2bkcj6V9tGCBFdI818kB%2fgEYY1oNx4elTHA%3d>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160627/cb91d11b/attachment-0001.html 


More information about the keycloak-user mailing list