Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can we fetch all the groups via JIRA Cloud REST API?

Tomoya Kabe May 28, 2018

(moved from https://community.atlassian.com/t5/Confluence-questions/How-can-we-fetch-all-the-groups-via-JIRA-Cloud-REST-API/qaq-p/806298, as I created wrong place)

I'm planning to develop a tool to manage Atlassian Groups via JIRA REST API.

To achieve that I believe I need to use group/picker API call found in REST documentation.

I'm trying to use this API and I receive only 20 groups in one response;

Response to /rest/api/2/groups/picker

=> {"header"=>"Showing 20 of 25 matching groups",
"total"=>25,
"groups"=>
[{"name"=>"a..b..c", "html"=>"a..b..c", "labels"=>[]},
{"name"=>"a.b.c", "html"=>"a.b.c", "labels"=>[]},
{"name"=>"aaa=bbb", "html"=>"aaa=bbb", "labels"=>[]},
{"name"=>"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "html"=>"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz", "labels"=>[]},
{"name"=>"administrators", "html"=>"administrators", "labels"=>[{"text"=>"Admin", "title"=>"Users added to this group will be given administrative access", "type"=>"ADMIN"}, {"text"=>"JIRA Core", "title"=>"Users added to this group will be given access to <strong>JIRA Core</strong>", "type"=>"SINGLE"}]},
{"name"=>"atlassian-addons-admin", "html"=>"atlassian-addons-admin", "labels"=>[{"text"=>"Admin", "title"=>"Users added to this group will be given administrative access", "type"=>"ADMIN"}, {"text"=>"JIRA Core", "title"=>"Users added to this group will be given access to <strong>JIRA Core</strong>", "type"=>"SINGLE"}]},
{"name"=>"confluence-users", "html"=>"confluence-users", "labels"=>[]},
(snip)

The document says it accepts maxResults but doesn't say startAt, which should be mandatory for pagenated request. (I just tried by specifying startAt in query parameter but it did not take effect)

I could specify 100 for example as maxResults and it just worked, but maxResults should have naturally a limitation, that is undocumented.

The document says

The number of groups returned is limited by the system property “jira.ajax.autocomplete.limit”

but it seems to apply for JIRA Server, not Cloud.

Is there any limitation for maxResults or undocumented way to pagenated request?

2 answers

1 accepted

2 votes
Answer accepted
Moses Thomas
Community Champion
May 28, 2018

@Tomoya KabePut a very  large  number you  will  force the system  property to  give you the max limit :)

 

Best!

Tomoya Kabe May 28, 2018

@Moses Thomas

You mean there is no paginated request way for Groups (i.e. REST API document is correct) and no upper limit for maxResults, right?

Thanks,

Moses Thomas
Community Champion
May 28, 2018

@Tomoya KabeREST api documentation is correct  because in cloud  i think you  don't have access to file Jira-Home/WEB-INF/classes/jpm.xml

Inside this file you can increase the maxlimit to a number 3x the number of groups you  have in your jira instance but you  can do this for sure in Jira server and restart JIRA

<property>
<key>jira.ajax.autocomplete.limit</key>
<name>AJAX Auto-complete Limit</name>
<description>The maximum number of items to show when making suggestions for auto-complete.</description>
<descriptionKey>jira.ajax.autocomplete.limit.desc</descriptionKey>
<default-value>20</default-value>
<type>uint</type>
<admin-editable>false</admin-editable>
<sysadmin-editable>false</sysadmin-editable>
</property>

 

Best regards,

Tomoya Kabe May 28, 2018

@Moses Thomas

Understood. Thanks so much!

0 votes
Larry Matter January 31, 2020

I discovered this by accident.  If you have less than 1000 groups, you can use this.  It returns the names of all groups (in json, not html) and zero users.  Now I need to figure out how to get all users. 

/rest/api/2/groupuserpicker?query=""\&maxResults=1000

 You can then query those names to get other details (like all the users that are members).

Larry Matter January 31, 2020

(this was on a CLI, so I had to escape the & with \.  Adjust your URL accordingly)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events