Forums

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

List ALL users in jira from api

Nick Hatfield November 11, 2022

Hello, I cannot seem to get this to work properly.  I basically went down the rabbit hole on this issue hitting problem after problem till i finally got to this solution: https://community.atlassian.com/t5/Jira-questions/Any-way-to-get-all-users-list-using-JIRA-REST-API/qaq-p/518530

 

When I try to mimic this,  by doing something like:


domain="example"
query=".@${domain}.com"

curl --request GET \
--url "https://${domain}.atlassian.net/rest/api/3/user/search?query=${query}&maxResults=2000" \
--user "${user}:${pass}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"



I end up with only a single result returning, even though there are many users that would match this domain name. What am I missing?

1 answer

1 accepted

4 votes
Answer accepted
Alex Koxaras -Relational-
Community Champion
November 11, 2022

Hi @Nick Hatfield and welcome to the community,

What do you mean by domain.com? Cloud domains end with .net.

Your API is this one https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-users-search-get

Nick Hatfield November 11, 2022

Hi thanks for the quick reply and warm welcome :) ...

 

the query = "." + "@" + "${domain}" + ".com" to represent wildcard@domain.com as a query req for all users with this email match

 

EDIT:

I just went through the link you provided. There something strange for me as every user has a different accountId. none of them are the same. So providing an accountId at all only shows a single user that it belongs to. 

 

Basically i just want to return a list of all users. Preferably, all users that dont have site access anymore, so i can delete those same users from the api based on the last activity date

 

Nick Hatfield November 11, 2022

Oh wait @Alex Koxaras -Relational- I dont know what happened there.. I re-clicked the link you sent and this is exactly what i needed to list all users! Thank you very much!!

Suggest an answer

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

Atlassian Community Events