Forums

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

REST API: How to read all users from outside our organization

Frank Dase March 27, 2022

Hi, 

we have a lot of user accounts which are owned by freelancers who work for our company. Is there a way to read all user accounts where the email address is not from our organization by using the REST API? 

Thanks in advance
Frank

1 answer

0 votes
Martin Bayer [MoroSystems, s.r.o.]
Community Champion
March 27, 2022

Hi @Frank Dase, I'd load all the users using REST API endpoint https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-users-search-get and filter it by the emailAddress value.

Frank Dase March 27, 2022

I did that, but I get some with email address and the most without. If I go this way, I have to make for each entry a 2nd REST API call with the accountID to get the email address. 

And the other thing is, I receive accounts of system apps as well. We have 205 accounts in total and I get 600. 

Frank Dase March 28, 2022

got it now. I have to run it asUser and not asApp. Then I receive the email addresses. 

Frank Dase March 28, 2022

Now I get a list of users, some have email addresses and some have no emailAddress node. 

Seems that the ones without the emailAddress node are the external users. That could be fine, but the list includes a lot of app users, too. Like "Zendesk Support for Jira", "Trello", "Slack" etc. 

I tried to to check the email by requesting it from rest/api/3/user/email/?accountId={accountId} but here I get the error "
errorMessages: [ 'OAuth 2.0 is not enabled for method: GET /rest/api/2/user/email' ]"


So, how can I filter the system / app users from the list?


Suggest an answer

Log in or Sign up to answer