Need to pull group sizes from API for Forge App

I am currently unable to discover a way to find a value for group sizes through the API. The only current way I can see is through paginating a list of users from GetUsersFromGroup (/rest/api/3/group/member) and doing a count on the list.

This is not an option because of the 25s function runtime limit and other constraints. I am already jumping through hoops to give my application the functionality it needs for gathering the information my end-user needs because of user volume in certain groups.

I’d like to have a special case for these high volume groups since they are too large to bulk access the required information from each user, however I cannot seem to find a way to reasonably count the groups given the constraints of Forge.

Please send help.

Welcome to the Atlassian Developer Community, @CoreyMosley.

If you are looking for a group’s total size using /rest/api/3/group/member, you can refer to the total field. Here’s an example response after I ran https://mysite.atlassian.net/rest/api/3/group/member?groupname=atlassian-staff&maxResults=1:

{
    "self": "https://mysite.atlassian.net/rest/api/3/group/member?includeInactiveUsers=false&maxResults=1&groupId=db3bb8ad-84ac-4990-92d7-aee5055c813d&startAt=0",
    "nextPage": "https://mysite.atlassian.net/rest/api/3/group/member?includeInactiveUsers=false&maxResults=1&groupId=db3bb8ad-84ac-4990-92d7-aee5055c813d&startAt=1",
    "maxResults": 1,
    "startAt": 0,
    "total": 13378,
    "isLast": false,
    "values":
    [
        ...
    ]
}

Since you are only interested in the group size, I used maxResults and set it to 1 to minimize the response size.

Let us know if this helps your use case.

Ian

2 Likes

@ianRagudo Perfect! Thank you so much.