JIRA Rest API find JIRA user based on user's email address

renaldi1982 December 14, 2013

Problem : I need to be able to find user in JIRA On Demand based on their email address.

I googled but couldn't find any relevant answer.

I checked JIRA Rest API guide and was thinking about using this "/rest/api/2/user/search" but i can't get it to work since the query still require username, and it wouldn't make sense to put user's email address as username

Any tips or recommandtion would be appreciated.

6 answers

2 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2020

Hello Everyone,

We have a quick update about this thread:

Due to the implementation of the new European General Data Protection Regulation (GDPR), the parameters used to identify users in REST API as "username" and "userKey" were replaced by the Atlassian account ID (accountId).

You can find more information regarding this change in the documentation below:

That being said, you must specify the accountId in the REST API to return your users on your Jira Cloud site:

GET /rest/api/3/user?accountId=xxxx

You can also search for the user's e-mail with the following API:

GET /rest/api/3/user/search?query=<e-mail>

To know the Account ID of multiple users by their usernames, you can use the experimental Endpoint below:

GET /rest/api/3/user/bulk/migration?username=xxxx&username=xxxxx

Greetings,

Petter Gonçalves - Atlassian Community Support

4 votes
Answer accepted
Norman Abramovitz
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 14, 2013

That is the correct call. It allows you to search by username, email address or name. The parameter is called username. You will need to check the result set to make sure the name or username was not matched.

https://docs.atlassian.com/jira/REST/latest/#d2e503

username

string

A query string used to search username, name or e-mail address

6 votes
Brian Choate March 4, 2015

That does not seem to work. I am trying to use the Rest API with our on-demand instance. If I use the parameter username=bchoate it works and will return my user record. If I use username=bchoate@wikia-inc.com it returns an empty array. In the case where I am using email the email string is getting properly url encoded before sending. 

Hai Minh Nguyen June 11, 2018

You can retrieve user information using email too. 

/rest/api/2/user/search?username=email@gmail.com

 

Like dhrupkumar likes this
2 votes
Chris Thistlethwaite December 14, 2018

Based on another question I started messing around with "User email visibility". If set to public or logged in users only, then the API returns results if queried using an email address. If it's set to hidden, then you get nothing, not even an error.

Vyshnavi Bandarupalli July 18, 2019

I changed User email visibility to Public but still could not see EmailAddress of user

0 votes
Sampath Kambar January 7, 2019

Hi ,

 

I am trying to fetch user list using my java code. But unable to fetch. If I try using chrome browser, I am able to get the json response.

{baseurl}/rest/api/2/user/search?username=sam

 

Please suggest.

 

Regards

Sam

0 votes
Mansi Patel April 24, 2018

I agree with Brian, this api doesn't work with email address. is there any solution for this one?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question