I have a requirement where I want to get the full list of Jira Users in my organization through JIRA Cloud REST APIs. I know I can get details of a user using /rest/api/3/user endpoint. Also I am aware that we can get multiple users details using /rest/api/3/user/bulk endpoint. But the problem with both these endpoints is that I have to know the userId of user I want to get details of.
I want to get the list of users same like we get the list of projects using /rest/api/3/project/search endpoint.
Also how can I get the total number of records in user object?
If anybody knows the answer please help.
Thanks in advance!
I would suggest
GET rest/api/2/user/search?username=.&maxResults=1000&includeInactive=true
Unless your Jira has more than 1000 users that should give you all of the users. The above suggested answer uses the REST API version 3 which is still in Beta and you apparently have to go through some effort to get it working.
Hi @Aniruddha Gayake ,
welcome to the community!
As described here you can get a list of all users using
GET /rest/api/3/users
Returns a list of all (active and inactive) users.
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Tessa Tuteleers for the response!
But how can I get the total number of users in organization?
eg. Suppose in my organization there are 100 Jira users, so when I do get users call I would get list of all users. But in the response body or header GET API do not return the total equals 100. I I want that. Is there any way to get total?
In short, I want users API endpoint to return something like thin along with response body:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Aniruddha Gayake ,
the call returns an array of users.
You can use nearly any programming language you are familiar with to get the size of the array.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tessa Tuteleers ,
But the my use case is that I want to get the data of all the users by iterating through the paginated user API. So, I must know where the end lies.
Aniruddha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tessa Tuteleers
I am using OAuth 2.0 (3LO) apps to get the code and then using that code to generate the access token. When I am using my access token to hit https://<site-url>/rest/api/3/users/search then it is giving me below error even if the scope I have added based on the documentation.
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.