Why rest API "/rest/api/latest/user/search?username=." can't retrieve more than 1000 users?

Meenal Khurana November 7, 2017

Hi,

I am having a jira server of version 7.3.3 and there are 13008 users in it. I am fetching the users using the rest api "/rest/api/latest/user/search?username=." in paginated format fetching 200 records at a time.  

After getting 1000 records, jira is not returning any records further. So can you tell me why jira does not return more than 1000 users? And how can I retrieve all my users using jira rest api?

 

Thanks

1 answer

0 votes
Gregor Kasmann_Actonic
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 7, 2017

You can use a workaround below:

1. Get all users

host-name/rest/api/2/user/search?startAt=0&maxResults=1000&username=a
host-name/rest/api/2/user/search?startAt=0&maxResults=1000&username=b
host-name/rest/api/2/user/search?startAt=0&maxResults=1000&username=c
...
host-name/rest/api/2/user/search?startAt=0&maxResults=1000&username=z

 2. Filter only unique users

Meenal Khurana November 8, 2017

Even if I use the above rest api and my system has more than 1000 users starting with the character "a", as soon as my startAt parameter reaches to 1000, I do not get further users from Jira.

My rest api where I try to fetch more than 1000 users starting with character "a" the rest api looks something like this "/rest/api/latest/user/search?startAt=1000&maxResults=200&username=a". This return me an empty list.

My Jira server has 1115 Jira users starting with "a".

roy_lyons
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 8, 2018

The very fact that this answer is probably the only correct answer gives me cancer.

I thought I would be slick and try rest/api/2/user/search?username=.&includeInactive=false&maxResults=1000&startAt=999

Yeah, that returns one user.

O.

M.

G.

 

I mean, I guess I can see where they are more GUI oriented... but wow.  All of their other startAt works as intended...

Suggest an answer

Log in or Sign up to answer