Jira rest api get all users

Hasitha Weerasinghe October 11, 2014

Hi all,

im new to JIRA Rest api. I want to save all the JIRA users to my database.

How do I get all the users from JIRA REST API?  

Btw I'm using Java to save to my database.

8 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

13 votes
Thomas Ehardt July 12, 2016

Came across this issue and I noticed that there is a way to do this:

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

 

This will get you a full user list (by default, will show active users only); see the documentation for more features (paging, showing inactive users, etc.).

Sascha Ernst September 15, 2016

This doesn't work with JIRA 7.2.0

If you replace '%' by '.' it works

GET /rest/api/2/user/search?username=.

Like # people like this
Daniel Jonsson November 17, 2016

And now you need to replace the "." with "_" as of November 2016

Matt Ward November 30, 2016

This still seems to show inactive users.  Also if you want to filter by a ".", how do you do it?  I used to use "%.%" to get first.last usernames only.  Now I have to use "." and I get a lot of inactive users and local db users instead of the ones I want. sad

Fawaz Joseph December 2, 2016

@Evan Jensen

You have to add the parameter includeInactive=true

Emeric JEGO February 4, 2017

It works perfectly !! thanks

Laksith Ekanayake December 4, 2017

It works perfectly adding '_' thanks guys

Tamas Dezso June 13, 2018

in June 2018 it does not work (not with percent sign, dot sign or underscore)  :(

SORRY, I take that back. it works (just have to be careful with the ampersand sign)

Like # people like this
5 votes
Pete DiMarco April 20, 2018

In Jira 7.3.0, it does not appear to be possible to search for "@" or "%40".  If it were, then we could iterate over a-z and 0-9 and search for "CHAR@".  Also:

  • startAt=1000 will not get you beyond the 1000 user limit.
  • The REST API's search behaves differently from the search box in Administration -> User Management.
  • Searches that include a comma ignore the comma.
  • "+" (which should evaluate to space) is ignored.

I'm currently able to get a list of all users by alternating between Active and Inactive users, but this will fail when my company adds 90 users.  We need a better solution.

4 votes
Jobin Kuruvilla [Adaptavist]
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.
October 12, 2014

You cannot get all users via REST API. You can only search using a search string.

Another option is to get all users in a group. If all of your users are in a group like "jira-users", you can try that: https://docs.atlassian.com/jira/REST/latest/#d2e31

 

Hasitha Weerasinghe October 12, 2014

Thank you Jobin, Is there a way to get all the groups? . i was thinking of getting all groups after that get all users in group by group.

Jobin Kuruvilla [Adaptavist]
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.
October 13, 2014

Nope, you can only search for groups using a search string (just like users). If you don't have a single group that has all users, the only other option is to write a custom plugin to expose a new REST resource I guess.

Hasitha Weerasinghe October 13, 2014

if i have a group called "SE" how am i gonna get all users who are in that group. Please provide me a REST call url. Thank you!

Jobin Kuruvilla [Adaptavist]
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.
October 14, 2014

${JIRA_Base_URL)/rest/api/2/group?groupname=SE&expand=users

Like Stephan Hannach likes this
3 votes
Full Las November 5, 2018

HI!
Can anybody help me to get the list of ALL users? I tried to use all of the cases, but nothing worked. I get the empty list every time. Response status is OK.

Безымянный.png

1 vote
joko hobo September 5, 2018

all above solutions are not working for me as i have 2000 resources, 

and beyond 1000 users it is not returning any record

i tried  applying wild search a..z

but it doesnt work for characters 'c' and 'g'

 

if anyone have any idea please share

1 vote
George Lewe (LSY)
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.
January 4, 2018

Underscore "_" does not work for me. However, all users can be assumed to have an email address, thus, "@" and "." works.

GET /rest/api/2/user/search?username=@&startAt=0&maxResults=1000&includeActive=true&includeInactive=false

or

GET /rest/api/2/user/search?username=.&startAt=0&maxResults=1000&includeActive=true&includeInactive=false

 

Best regards,
George

Patrick Hobusch March 5, 2018

Not working for me with Jira v7.7.1. Both are returning internal server error...

Edit: Only v7.7.1 seems to be affected. v7.7.0 and v7.8.0 are working.

moos3 September 21, 2018

This doesn't seem to work either for me on the latest jira cloud :(

Like Alexander Pampushko likes this
0 votes
Madhuri May 29, 2017

HI,

Cam someone please let me know how to use above GEt rest API statement with jira url prefix to fetch alla ctive users in jira

 

<myjira url>/GET/rest/api/latest/user/search?startAt=0&amp;maxResults=10&amp;username

 

Is this the correct way to use?

 

Thanks,

Madhuri

0 votes
Treethawat Thanawachiramate October 12, 2014

 If possible, I would suggest to get all users directly from a database since it's easier.

Hasitha Weerasinghe October 12, 2014

Thank you Treethawat, nope its not possible to get from database directly

Matt Ward November 30, 2016

I don't think this is true as a blanket statement.  It is very possible, as that is how you find the users attributing to the active licenses per Atlassian's recommendation.  I don't like the solution that much since you need the db password, etc, but it is a great workaround if you are in a bind.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question