Get user by email address as Site Admin

Hi, I am writing a widget for submitting tickets. My API needs to be able to find the users account, if it exists. It does this via the users email address they logged into my site with. So far I have found 2 approaches:

1: using rest/api/3/groupuserpicker?query='email@example.com'
I can search for users using this endpoint, then filter for users with exact matching email address. This works great for users who have their email address set to public. However, this will not find users with private email addresses, even signed in as a site admin.

2: Using rest/api/3/groupuserpicker
This somewhat works. It will find users by email, even if their email is private. However, it returns several results, and there is no way to know which one is the actual account with the email address.

How can I get a user by its email address as a site admin?

Hi @PandoSoftwareSystemU, try using this method:

rest/api/3/user/search?query=email@example.com

You should still be able to search with an exact email and get the accountId, even for a user that has their email visibility settings locked down. The email address won’t be returned in the payload, but in your use case, you already have it.

1 Like

Thanks. This seems to work as expected as long as the email address is not in quotes, which is what I was doing. Not sure why it behaves this way but if I remove the quotes it does what I need. Thanks!

I had a similar issue with this.

I noticed that when I verified my domain and claimed those users as “managed accounts”, the emailAddress values were included in the response for those accounts.

This is specifically in regards to

GET /rest/api/3/user/search

GET /rest/api/3/users/search

I have not seem this documented or confirmed by Jira though.