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?
Community moderators have prevented the ability to post new answers.
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
It works for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This commang works:
GET /rest/api/2/user/search?username=.&startAt=0&maxResults=2000
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"/rest/api/2/user/assignable/search?project=PROJECT_NAME_HERE"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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&maxResults=1000&username=%
solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.