Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Find a user by email address in Confluence and Bitbucket using Java API/SDK

Hi everyone,


I'm writing a plugin for Jira/Bitbucket/Confluence Server, and for some reasons, I need to get a user by searching its email address, then I try to find an API like this:

User user = userService.getUserByEmail(givenEmail)

I eventually found one such API in Jira:

Iterable<ApplicationUser> users = ComponentAccessor.getUserSearchService().findUsersByEmail(email);

But I wonder if there‘re any APIs like that in Confluence or Bitbucket? Or any other APIs that I can use to search users by email address?


Thanks so much. 


1 answer

1 accepted

0 votes
Answer accepted

I just found such an API in Bitbucket:


And I found it for Confluence:


Although it's deprecated, but we can refer its implemention. 

(For Confluence) Such as:

* @param email
* @return
* @see DefaultUserAccessor#getUsersByEmail(String)
private SearchResult getUsersByEmail(String email) {
if (!TextUtils.stringSet(email)) {
return new DefaultSearchResult();
} else {
SearchResult<com.atlassian.user.User> results = null;
EmailTermQuery emailQuery = new EmailTermQuery(email);

try {
results = entityQueryParser.findUsers(emailQuery);
results = ComponentLocator.getComponent(EntityQueryParser.class).findUsers(emailQuery);
} catch (EntityException var5) {

return results;

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events