Total size parameter for search user groups and get group members APIs

What is changing?
We have enhance APIs to include optional response parameter totalSize to search groups, get group members by group Id and get group members by group name APIs. It will return total counts of objects before pagination is applied.

Total size parameter is retrieved if it is explicitly requested. To request total size parameter we have added new request parameter shouldReturnTotalSize.

New request parameter
parameters:
- name: shouldReturnTotalSize
in: query
description: |-
Whether to include total size parameter in the results.
Note, fetching total size property is an expensive operation; use it if your use case needs this value.
schema:
type: boolean
default: false

New response parameter
totalSize:
type: integer
format: int64
default: 0
description: |-
This property will return total count of the objects before pagination is applied.
This value is returned if shouldReturnTotalSize is set to true.

Example for Get group members by groupId

Example for Get group members by group name

Example for Search user groups

Why is it changing?
We are trying to fill in the missing gap between API and UI components our partners are using. Our partners use the UI component Atlaskit dynamic table to display user groups and group members, but due to lack of total size parameter, they can not take full advantage of dynamic table pagination functionality.

After these changes, they can take advantage of dynamic table pagination.

Fetching total size parameter is an expensive operation, as result, we have not included this parameter in all our paginated APIs. We need to access it before making changes to other APIs.

What do I need to do?
TotalSize parameter is returned if request parameter shouldReturnTotalSize is set to true.
see the example

When will this roll out?
First we’ll roll out changes to the Confluence Cloud beta group and 10% production on Jan 19, 2022, then we will release in increment phases in production (10%, 25%, 50% and 100%). Target to 100% production Feb 3, 2022.

Please note that because of a code freeze, the documentation on DAC will not be updated until January 26th. I have included as much information as possible, including demos, here.

1 Like

Hi there, I am using the shouldReturnTotalSize to retrieve the total size of the members in a group. But somehow the totalSize returned did not match the actual size.
The response was like { "results": [ ... ], "start": 0, "limit": 200, "size": 10, "totalSize": 12, "_links": { "base": "https://weiwen-test.atlassian.net/wiki", "context": "/wiki", "self": "https://weiwen-test.atlassian.net/wiki/rest/api/group/{groupId}}/membersByGroupId?shouldReturnTotalSize=true" } }
Just wondering what potentially could cause this size mismatching.

Thanks for reaching out to us. Sorry for the inconvenience you facing

Unfortunately I could not recreate the issue on my end. It looks like this is happening for some specific data conditions.

To narrow down this issue, I have a few questions.

  • Do you have inactive users, and do you see them in the results?

  • Have you recently removed users from the group against which you are querying?

  • For any group ID you seeing the mismatch or just for one of the group ID?

Thanks for your prompt reply @TapanParikh.

  • I remember I removed users and reactived them couple times for testing purpose. Short answer is I don’t think I have inactive users. But not sure how the backend logic works.
  • Same as above
  • This is the only one I noticed so far because I have a loop to make sure I retrieve all the members by sending subsequent requests when the totalsize > the size I have retrieved. And it was stuck in an infinite loop.

Thanks for the answers.

I remember I removed users and reactived them couple times for testing purpose.

Using UI to remove and reactive the users or REST APIs?

This is the only one I noticed so far because I have a loop to make sure I retrieve all the members by sending subsequent requests when the totalsize > the size I have retrieved. And it was stuck in an infinite loop.

I might not be fully aware of the app logic but for your termination condition can’t you check if the API result is empty or not?
At least this solution will keep you moving forward.

Meanwhile, I will see if I can recreate this issue.

Thanks for the reply.

Using UI to remove and reactive the users or REST APIs?

using the UI

I might not be fully aware of the app logic but for your termination condition can’t you check if the API result is empty or not?
At least this solution will keep you moving forward.

Yes, I have implement a workaround for this. I was just wondering what the root cause will be.

FYI. The response I am getting today contains matched size and totalSize.
"start": 0, "limit": 200, "size": 12, "totalSize": 12
I don’t think I have changed anything but will keep an eye on this.

Thanks for the update.
Sure, if you find any specific steps for reproducing this issue, that would be a great help.