Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I get users list using REST API

Elad Malki Malki November 12, 2012

How do I get users list using REST API?

I need to get All users in one call

8 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Elad Malki Malki November 17, 2012

thanks for commenting, best option we have found in REST is:

https://servername/rest/api/2/user/search?username=a

Which return all users that has 'a' somewhere, but doing it on the entire ABC is ugly... We couldn't find a way to query for multiple letters....

Mikhail_Kopylov
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.
August 18, 2015

try using wildcard: username=a*

nitesh8860 May 25, 2017

try using "aeiou" for all names.

3 votes
Abhinav Bajpai May 31, 2019

https://your-domain.atlassian.com/rest/api/2/user/search?username=&startAt=0&maxResults=10000

 

This is what you want. It searches a blank string in all users and blank string is present in all the strings, so it works fine ;)

Kyle McCauley May 31, 2019

@Abhinav Bajpai  This does not work as it only returns 100 results. Using Pagination to change the startAt value does not work either. All calls stop at 100 results whether you use startAt=99 or startAt = 0. 

Jens Rosemeier June 13, 2019

according to documentation, the param "maxResults" can be set to a maximum of 1.000 .  If the value is higher, as in above example its 10.000, the it defaults to 100.

Jens Rosemeier June 13, 2019

Im using Jira Cloud, can anybody confirm, how it behaves on Jira Server?

In past it was working with:
`https://servername/rest/api/2/user/search?username=.&startAt=0&maxResults=1000` 
"username = ." (dot)

Does this still work?

Abhinav Bajpai June 13, 2019

@Jens Rosemeier Ohh, thanks for the information, actually I faced the same limit issue and scrolled using startAt but totally forgot about this comment :P

Abhinav Bajpai June 13, 2019

for it in self.projects:
size = 100
initial = 0

'''
JIRA API pushes only 100 results at a time so putting a while
loop to fetch whole data in batch of 100s
'''
while True:
start = initial * size
try:
issues = self.jira.search_issues('project={} and updated > -{}m and updated < 0m'.format(it.id, self.diff),start,size,expand='changelog')
print("Issues of new proj: " + str(it.key))
if len(issues) == 0:
break
initial += 1

#Iterate on all updated issues
for issue in issues:

 

This python code uses the jira api and fetches in batch of 100 till it gets 0 results in response

2 votes
Krishna Prasad PS October 11, 2017

Hi,

It is possible to get the list all users (may be with in the limit of maximum returnable results). We need to use the search API.

https://servername/rest/api/2/user/search?username=%

The wildcard character to be used for this purpose is "%".

Christof Hurst January 23, 2019

This did not work.

Jens Rosemeier June 13, 2019

I noticed this now. It did indeed work on Jira Cloud instance just recently it stopped working.

What i noticed (undocumented), on Jira Cloud to get all users without filter, it must be called like:
`https://servername/rest/api/2/user/search?username=

Empty value.

This is different to Jira Server instances.

Like Thomas Pilewicz likes this
0 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 not possible with REST, please vote *and* comment on https://jira.atlassian.com/browse/JRA-29069-- explaining the need for it. If enough people are explaining the business need for this, Atlassian will fix this. It is not hard to fix, it's much hard to get the required attention for having this scheduled.

0 votes
Elad Malki Malki November 17, 2012

thanks for commenting, best option we have found in REST is:

https://servername/rest/api/2/user/search?username=a

Which return all users that has 'a' somewhere, but doing it on the entire ABC is ugly... We couldn't find a way to query for multiple letters....

0 votes
vkharisma
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 14, 2012

I don't think the Rest API has this ability. As far as I know you'll have to choose a different way, for example you could use the Soap API to do so as shown in this question JIRA SOAP API : get the list of users. Another way might be querying the DB directly.

0 votes
Norman Abramovitz
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.
November 12, 2012

No REST API returns all users in a single call if you have more than 1000 users. I would recomend the multiprojectsearch api in the document John pointed you to.

0 votes
JohnA
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.
November 12, 2012

Hi Elad,

You didn't actually state which application you wanted to get a list of users from, but hopefully this document will be of some use to you as it explains how to use the API and also documents the APIs of the different Atlassian products: https://developer.atlassian.com/display/REST/REST+API+Developer+Documentation

All the best,
John

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events