I am trying to get a list of users in jira i am using the api
Hi @Ankit kharola
Have you tried this end point? -> https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-bulk-get
This gives a paginated list..
@Ankit kharola
You need to loop through till you get 0 count for users.
Assuming you are using python
payload = {'startAt': 0, 'maxResults': 1000}while True:call the api end pointGet number of users returned.if number of users == 1000: payload['startAt'] += 1000else: break
hope this helps
@Vishal Biyani hello sir will there be a case where number of users are more than the the number i set in maxresuts? because when we are fetching issues we get a total so we can run a while loop on that as we now the total numbr of issues but here i am confused about that
hello @Fazila Ashraf i did look at the endpoint but the doubt i have is the endpoint you mentioned Returns a paginated list of the users specified by one or more account IDs. but i was looking to fetch all the users. and its not returning the total number of users like we get when we are fetching issues. my doubt was when i am getting all users we dont get a total field there so how would we fetch all the users that are there?
use this end point, with startAt=0 and maxResults=1000
https://your-domain.atlassian.net//rest/api/3/users?startAt=0&maxResults=1000
Say you have 1500 users.
in the first call when response.json() length is calculated it will return 1000.
2nd call will be
https://your-domain.atlassian.net//rest/api/3/users?startAt=1000&maxResults=1000
this will give the array length at 500 and this will be termination condition for the while loop.
It looks like you're new here. Sign in or register to get started.