Hello,
You have to use the JAVA API to do that.
In the maven, just add
<dependencies>
<dependency>
<groupId>org.bonitasoft.engine</groupId>
<artifactId>bonita-client</artifactId>
<version>7.10.4</version>
</dependency>
then here a simple Java example
package org.bonitasoft.training;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bonitasoft.engine.api.ApiAccessType;
import org.bonitasoft.engine.api.IdentityAPI;
import org.bonitasoft.engine.api.LoginAPI;
import org.bonitasoft.engine.api.TenantAPIAccessor;
import org.bonitasoft.engine.identity.RoleSearchDescriptor;
import org.bonitasoft.engine.identity.User;
import org.bonitasoft.engine.identity.UserCriterion;
import org.bonitasoft.engine.identity.UserSearchDescriptor;
import org.bonitasoft.engine.search.SearchOptionsBuilder;
import org.bonitasoft.engine.search.SearchResult;
import org.bonitasoft.engine.session.APISession;
import org.bonitasoft.engine.util.APITypeManager;
public class TestUserList {
public static void main(final String args[]) {
final Logger logger = Logger.getLogger("TestUserList");
try {
final Map<String, String> map = new HashMap<String, String>();
map.put("server.url", "http://localhost:8080");
map.put("application.name", "bonita");
APITypeManager.setAPITypeAndParams(ApiAccessType.HTTP, map);
// Set the username and password
final String username = "William.Jobs";
final String password = "bpm";
// get the LoginAPI using the TenantAPIAccessor
final LoginAPI loginAPI = TenantAPIAccessor.getLoginAPI();
// log in to the tenant to create a session
final APISession session = loginAPI.login(username, password);
// get the identityAPI bound to the session created previously.
final IdentityAPI identity = TenantAPIAccessor.getIdentityAPI(session);
// get the list of users
final List<User> user = identity.getUsers(0, 30, UserCriterion.FIRST_NAME_ASC);
// display the list of userNames
for (int i = 0; i < user.size(); i++) {
System.out.println(user.get(i).getUserName());
}
loginAPI.logout(session);
} catch (final Exception e) {
logger.log(Level.SEVERE, "ERROR RETRIEVING USERS", e);
}
}
}
Hope this help,