Rate this page:
Crowd currently supports searching for users and groups using the Crowd REST API.
It is possible to search for users using the following methods:
com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchUsers com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchUsersWithAttributes com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchUserNames
This will perform a search on all the directories assigned to your application and return a list of users (depending on the method the output will be strings, or objects) matching the search restrictions. Queries can be paged and filtered using the API. The full list of searchable properties can be found in the class.
Suppose we would like to obtain a list of 20 active users from Crowd. This could be achieved by performing the following:
// obtain an instance of the RestCrowdClient CrowdClient client = new RestCrowdClientFactory().newInstance(getBaseUrl(), APPLICATION_NAME, APPLICATION_PASSWORD); // build search criteria SearchRestriction restriction = Restriction.on(UserTermKeys.ACTIVE).exactlyMatching(true); // execute search List<User> users = client.searchUsers(restriction, 0, 20);
You can search for groups in a similar manner to searching for users, by using the following methods:
com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchGroups com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchGroupsWithAttributes com.atlassian.crowd.integration.rest.service.RestCrowdClient#searchGroupNames
Just like with users, group queries can be paged and filtered using the API. The full list of searchable properties can be found in the class.
It is possible to perform direct searches to determine if a user is a member of a group, to list the members of a group, to list the group memberships of a user, find a user by their name and much more using methods on the CrowdClient interface.
Rate this page: