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?
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
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.
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.
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.
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.
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.
"/rest/api/2/user/assignable/search?project=PROJECT_NAME_HERE"
This is now possible - see my answer to another question here
It works for me
This commang works:
GET /rest/api/2/user/search?username=.&startAt=0&maxResults=2000
It looks like you're new here. Sign in or register to get started.