I'm trying to get the JIRA user object using the endpoint
http://domain.atlassian.net/rest/api/2/user/search?query='email'
When I try to search using the actual email 'a.b@example.com' I don't get any results for the user ( but a status 200 OK ), but if I change the email to 'a@example.com' I get the proper user object.
If someone could point me in the correct direction.
I'm trying the request via postman at the moment and using basic auth for all the requests.
Hi,
I think this search work by username or userKey, not by email
Hi @Umesh Kumar and Welcome to the Atlassian Community!
@Nir Haimov is correct about the search, and here is the documentation on that API call:
https://docs.atlassian.com/software/jira/docs/api/REST/8.5.4/#api/2/user-getUser
Best regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Bill Sheboy .
Um, ok. So basically string passed tries to match the username or email or name and returns the result? Yeah that'd make sense, I read it wrong maybe because I was looking for an easy answer :D
@Nir Haimov @Bill Sheboy Is there a possible way to search users by email, maybe by query?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think I figured it out, I can use the same search and iterate through results to match the email address and remove any duplicates. Except that the user object wasn't returning email address in the response obtained from JIRA.
Perhaps that's related to permission issue of the account being used for querying JIRA?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmmm...
Yes, if you use the email id alone this should work. For your example of an email address of a.b@example.com
http://domain.atlassian.net/rest/api/2/user?username=a.b
You can rapidly test this with your own email address versus user name. The query string is just the same for both, as you noted.
If the email addresses you are searching for are not unique, due to the domains being different, you may want to follow up with support about how to proceed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see the email related info here: https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill SheboyEmail addresses are unique but the search doesn't works as expected.
So for the email address: a.b@example.com, I tried the query string "a.b@example.com" and "a.b" both didn't give me the results. But If I change the query to "a@example.com" or just "a", rather even "a b" it works fine which is bit weird.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, and sorry that I could not be of more help. I suggest pinging Atlassian support as this may just be a syntax issue that is missing from the documentation (or a defect), and after a few searches I could not find examples to help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Bill Sheboythat's not a problem at all, you were definitely helpful :) Thank you so much.
Have a great day!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.