RequestTimeoutError with 1.0/groups endpoint
Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.
Summary
When retrieving a user group for a workspace using the Bitbucket Cloud groups endpoint API the API succeeds sometimes and sometimes it fails with a "request timeout error." This page's objective is to provide a workaround for listing groups and their members within a given workspace using Bitbucket Cloud group endpoint.
Cause
Bitbucket Cloud API's maximum allowed response time is around 28 seconds. If the workspace has a lot of groups and members, then there is a probability that the API would return *request timeout error*.
Bitbucket Cloud Group Endpoint API
https://bitbucket.org/!api/1.0/groups/Solution
To make the API performant, the workaround is to use the `exclude_members=true` query string param. Then, for each group get the members with a separate API request.
Fetch all groups from https://bitbucket.org/!api/1.0/groups/<workspace>?exclude_members=true
curl -u <USER-NAME>:<APP-PASSWORD> -X GET https://bitbucket.org/!api/1.0/groups/<WORKSPACE-NAME>?exclude_members=trueIteratively fetch all group members from https://bitbucket.org/!api/1.0/groups/<workspace>/<group>/members
curl -u <USER-NAME>:<APP-PASSWORD> -X GET https://bitbucket.org/!api/1.0/groups/<WORKSPACE-NAME>/<GROUP-NAME>/membersWas this helpful?