Hi,
I need to read all users in a particular group by using REST API, i have found the below query
https://<companyName>.atlassian.net/rest/api/2/group?groupName=developers&expand=users
The above REST API returns only first 50 users in group , and i can't set the maxResults value in this above REST API
Please share your knowledge.
Thanks in advance.
HI All,
I have to read all users in a "Developers" group by using the below format
https://<company>.atlassian.net/rest/api/2/group?groupname=developers&expand=users[0:49]
It returns the below JSON
{ "name": "developers", "self": "https://<company>.atlassian.net/rest/api/2/group?groupname=developers", "users": { "size": 150, "items": [], "max-results": 50, "start-index": 0, "end-index": 49 }, "expand": "users" }
Then i have parse the return JSON, if the return size is >50 than i have used the below REST API
https://<company>.atlassian.net/rest/api/2/group?groupname=developers&expand=users[50:99]
It returns below JSON
{ "name": "developers", "self": "https://<company>.atlassian.net/rest/api/2/group?groupname=developers", "users": { "size": 150, "items": [], "max-results": 50, "start-index": 50, "end-index": 99 }, "expand": "users" }
then
https://<company>.atlassian.net/rest/api/2/group?groupname=developers&expand=users[100:149]
{ "name": "developers", "self": "https://<company>.atlassian.net/rest/api/2/group?groupname=developers", "users": { "size": 150, "items": [], "max-results": 50, "start-index": 100, "end-index": 149 }, "expand": "users" }
rest/api/2/group?groupname=jira-users&expand=users&startAt=0&maxresult=250
This returns only 50 users.
I tried all of them above but result did not change.
Only 50 users were returned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It will only get a limited number no matter how large the max-results is set to (something like 250 maximum limit).
The solution to get the whole mess is to read multiple pages, changing the start each time.
I use:
https://<company>/rest/api/latest/group/member?groupname=developersusers&startAt=0&maxresult=250
And then you call it multiple times, changing "startAt" based on how many results you've gotten so far.
Next problem: how do you know when you are done? There is a field in the json "isLast". If this is TRUE you are done and you've got it all.
There is one other little problem you might run into: if you get too many lines from the server in too short a time it hits a limit and stops. The limit is something like 5000 and the time limit is something like 5 minutes. So every 5000 lines, just stop for 5 minutes and it will work.
Note that this is for JIRA; Confluence and Bitbucket also have the paging problem but they solve them differently.
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.
Use maxResults parameter in the url :
https://<company>.atlassian.net/rest/api/2/group?maxResults=1000&groupname=developers
I tried the same for obtaining issues of type Task and it worked :
https://<company>.atlassian.net/rest/api/2/search?maxResults=1000&jql=issuetype=Task
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.
maxResults parameter works for searching task
https://<company>.atlassian.net/rest/api/2/search?maxResults=1000&jql=issuetype=Task
but unfortunately for displaying users in a group:
https://<company>.atlassian.net/rest/api/2/group?maxResults=1000&groupname=developers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you tried like this
/rest/api/2/group?groupname=developers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ram,
Thanks for your update, i have tried that request REST API and
- find the numbers of users in this group ( for ex - user count 347 )
Then i expand the users in this api
- https://<companyName>.atlassian.net/rest/api/2/group?groupname=developers?exapnd=users
I am find only 50 users details in the return JSON , because max-Results set as 50 default in On demand JIRA.
How can i increase that maxResults to 400 ?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you tried with out "expand=users"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ram
Yes, i have tried with out "expand=users"
https://<company>.atlassian.net/rest/api/2/group?groupname=developers
And i got the below JSON
{ "name": "developers", "self": "https://<company>.atlassian.net/rest/api/2/group?groupname=developers", "users": { "size": 217, "items": [], "max-results": 50, "start-index": 0, "end-index": 0 }, "expand": "users" }
I need to read the all users information ( username, dispalyname , address etc., ) in the developers using REST API. How to achieve my goal?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you try like this
https://<company>.atlassian.net/rest/api/2/group?groupname=developersusers&expand=users[0:100]
if it works then you can change to max number
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.