Any way to get all users list using JIRA REST API

Umang Kedia February 21, 2013

I couldn't find any direct query to get list of all users using REST API. Is there any workaround to do that? How does JIRA autocomplete get the list?

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Raktim Biswas June 26, 2018

Try using the 

You can also pass the number of users to be returned using the startAt and maxResults parameter, like:

/rest/api/2/user/search?username=%25&startAt=xx&maxResults=xx

 

Priyank July 27, 2018

It works for me

Ladislav Zástěra October 5, 2018

This commang works:

GET /rest/api/2/user/search?username=.&startAt=0&maxResults=2000

Like # people like this
7 votes
Andrew Somerville September 15, 2014

"/rest/api/2/user/assignable/search?project=PROJECT_NAME_HERE"

2 votes
Sorin Sbarnea (Citrix)
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.
July 4, 2014

As of today this is still not possible using REST, please vote AND comment on https://jira.atlassian.com/browse/JRA-29069-- explaining the business reasons for having this implemented sooner than later or never. Atlassian is reading the comments and will schedule if the impact is important.

1 vote
Jozef Kotlár
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.
February 21, 2013

You need to provide at least one char to /rest/api/2/user/search. Anyway, thats the way autocomplete works.

To get all users I am afraid you need to iterate all a..z and merge results together.

Jim Ryan February 26, 2013

Jozef, would you please explain "provide at least one char to..."? I am trying:

<my jira>.atlassian.net/rest/api/2/user/search/j

but it doesn't work (404). I need to get a list of all of our users. Thank you.

Jim Ryan February 26, 2013

This comment helps me to understand what Jozef means. I think it is giving unweildy results, but it works. If I choose the letter 'j' it gives the result "jryan" and also a colleague who does not have a 'j' in his username but does have a 'j' in his display name. I notice that the autocomplete in the user entry form in the browser-based Jira client also suggests my colleague (and myself) when I type 'j' into it. Interesting!

In any event, I can use these results to get all of our company users by carefully adding them to a Java collection without allowing any repeats.

Jozef Kotlár
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.
February 26, 2013

Link in my answer was mangled (or mistyped). It should point to REST API. Of course - that at least single char should go username argument. Results are strange, but as it serves for AJAX autocompletion - it is consistent with it. As other arguments, you should be prepared for paged retrieval for big user base.

Jim Ryan February 26, 2013

Thanks, Jozef. I have added a getAllUsers() to JerseyUserRestClient that implements this logic (for user base < 1000).

gvidali February 5, 2017

Hi,

 

I used to be confident that iterating all a...z was working but it actually doesn't 

I found out some users were skipped and don't know why.

Names starting with "ma", "mi", "se", "si", so", "st", or "su" were all missing.

Better go with 

GET /rest/api/latest/user/search?startAt=0&amp;maxResults=1000&amp;username=%

solution

Geo Zhang March 16, 2017

The reason why there is some user missed is that you only get once for one letter, and the max result is only 1000, but the real users should be more that that, you need to loop from 1000 to 2000 to 3000,  until all users are got. I have implemented that, wish this helps you. 

Like Borlas Team likes this
0 votes
Thomas Ehardt July 12, 2016

This is now possible - see my answer to another question here

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question