Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get customer by email address (as site admin) via rest API

Gradyn Wursten
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 27, 2021

I am writing a custom widget for submitting tickets. The user authenticates with my page using email and password. At the backend, when submitting a ticket thru my widget, the users account is located via their email address and a ticket is created with them as the reporter. If the user does not already exist, they are invited. Problem is I cannot find a reliable way to look up a user by their email address. So far, I have found 2 methods:

1 `rest/api/3/user/search?query='example@example.com'`

This mostly works. All I have to do is find the result with the matching email address. Only problem is, if the user has their email address hidden, they will not be in the results.

2: `rest/api/3/groupuserpicker?query='example@example.com'`

Same problem as the last one - does not return any users with email hidden (even as a site admin). This one doesn't return email addresses at all anyway so it'd be impossible to find the matching result anyway.

This creates an issue where the widget cannot find the user, so it goes to create one instead. It cant create a user either, because one already exists under that email. How can I get a user by email address as a site admin via the rest API?

2 answers

0 votes
KORTX Support February 2, 2022

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.

0 votes
Prince Nyeche
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.
September 27, 2021

Hi @Gradyn Wursten 

Try not to rely on email addresses on cloud. By default this is based on the user privacy settings. If you're creating an external app, you can request for the email API, however you have to be a vendor. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events