Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

(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

1 vote
Answer accepted

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

 

Best!

@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,

@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,

@Moses Thomas

Understood. Thanks so much!

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).

(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

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you