RequestTimeoutError with 1.0/groups endpoint
Platform Notice: Cloud Only - This article only applies to Atlassian products 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.
Environment
Bitbucket Cloud
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 API would return *request timeout error*.
Bitbucket Cloud Group Endpoint API
1
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
1
curl -u <USER-NAME>:<APP-PASSWORD> -X GET https://bitbucket.org/!api/1.0/groups/<WORKSPACE-NAME>?exclude_members=true
Iteratively fetch all group members from https://bitbucket.org/!api/1.0/groups/<workspace>/<group>/members
1
curl -u <USER-NAME>:<APP-PASSWORD> -X GET https://bitbucket.org/!api/1.0/groups/<WORKSPACE-NAME>/<GROUP-NAME>/members
Was this helpful?