Confluence Cloud REST API Get Groups - is totalSize supported?

According to the response parameters at Get Groups API Response- Confluence Cloud, the shouldReturnTotalSize boolean should be supported, and when set to True, it should return totalSize.

However,

import requests
from requests.auth import HTTPBasicAuth
import json
import csv
url = "https://xxxx.atlassian.net/wiki/rest/api/group"

auth = HTTPBasicAuth("myname@xxxx.com", "abcdefghijklomnop")
headers = {
    "Accept": "application/json",

}

response = requests.request(
   "GET",
   url,
   headers=headers,
   auth=auth,
   params= {
         'start': 0,
         'limit': 2,
         'shouldReturnTotalSize': True
   }
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

returns the following, missing totalSize. Please assist!

 "_links": {
        "base": "https://xxxx.atlassian.net/wiki",
        "context": "/wiki",
        "next": "/rest/api/group?next=true&limit=2&start=2&shouldReturnTotalSize=True",
        "self": "https://xxxx.atlassian.net/wiki/rest/api/group?shouldReturnTotalSize=True"
    },
    "limit": 2,
    "results": [
        {
            "_links": {
                "self": "https://sonosinc-sandbox-559.atlassian.net/wiki/rest/experimental/group/system-administrators"
            },
            "id": "d58844de-702b-4d51-a640-d34c4e6be24b",
            "name": "system-administrators",
            "type": "group"
        },
        {
            "_links": {
                "self": "https://sonosinc-sandbox-559.atlassian.net/wiki/rest/experimental/group/confluence-users-sonosinc-sandbox-559"
            },
            "id": "ea750de6-8025-4a49-bdda-63df0a3b2dc7",
            "name": "confluence-users-sonosinc-sandbox-559",
            "type": "group"
        }
    ],
    "size": 2,
    "start": 0
}

Hello @BryanGuffey2

It’s probably just errata in the documentation.

  1. The parameter shouldReturnTotalSize is not listed as being a supported. Only start, limit and accessType are shown as supported.
  2. A totalSize object is not included in the sample response.
1 Like

Might be a typo in the docs as I can see from this post that only certain endpoints support totalSize.

Having said that, you can query the totalSize by hitting https://your-domain.atlassian.net/wiki/rest/api/group/picker?shouldReturnTotalSize=true

1 Like

Thanks - so how would I handle pagination if I can’t get totalSize?

Does the endpoint I included above not solve your issue?

https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-group/#api-wiki-rest-api-group-picker-get

It provides that count, so I guess I could store that and then do a compare against the limit.