I'm lookig for a way to get an specific user with Jira DC REST API using the email adress

Felipe Pérez _ServiceRocket_ May 8, 2024

When I use the following API call

http://www.example.com/jira/rest/api/2/user?username=f.per@servicerocket.com

I get all the users with a similar email to the one provided instead of the specified user.

In my example, I get these two users instead of the one related to the email

"key": "JIRAUSER10105",
"name": "fperezcorrea",
"emailAddress": "f.per.correa@servicerocket.com",
"displayName": "Felipe Perez Correa",
       
"key": "JIRAUSER10101",     
"name": "fperezSR",   
"emailAddress": "f.per@servicerocket.com,"   
 "displayName": "felipe perez SR",
       

How can I get the specific user using the email address, is it possible?

Thank you in Advance

1 answer

1 accepted

0 votes
Answer accepted
David Bakkers
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.
May 8, 2024

Hello @Felipe Pérez _ServiceRocket_ 

Firstly, your question is about Jira DC, but you've also tagged your question with cloud and said it's a cloud deployment, which is putting the question in the wrong group and is confusing. Jira CLOUD is not Jira DATA CENTER.

The reason you're getting the results is because the string 'f.per@servicerocket.com' isn't a username, it's an email address.

If you want to search for a user based on their email address, use the Find Users endpoint, as it can search on email addresses

Felipe Pérez _ServiceRocket_ May 13, 2024

Hi David!

Thanks for the clarification on the tag that has been removed.

Regarding the "Find User" endpoint, I tried but got the same result,

this is my call: 

http://www.example.com/jira/rest/api/2/user/search?username=f.per@servicerocket.com

Result:

"key": "JIRAUSER10105",
"name": "fperezcorrea",
"emailAddress": "f.per.correa@servicerocket.com",
"displayName": "Felipe Perez Correa",
       
"key": "JIRAUSER10101",     
"name": "fperezSR",   
"emailAddress": "f.per@servicerocket.com,"   
 "displayName": "felipe perez SR",
So I'm still getting another user who doesn't have the email address I put in to get the call. Any suggestion to get the specific user using the email address?
Thanks!
Felipe Pérez _ServiceRocket_ May 13, 2024

I'll correct what you suggested to me and try again. thanks

Felipe Pérez _ServiceRocket_ May 13, 2024

Hi @David Bakkers 

Here is the new corrected question. I also tried what you suggested, but it didn't work. Any ideas? 

Thanks

David Bakkers
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.
May 13, 2024

What you are describing with the Find Users endpoint is a known bug that affects the Server / Data Center products. Refer to JRASERVER-72862.

Simply put, you are searching for a user who has an email address with a first part that matches another user's email address.

Either:

1. Do secondary filtering of the results from the endpoint to find the exact match, or

2. Stop using email addresses in user accounts that are identical in their fist part.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events