Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Use API To Get A List of All repositories and the users that have administrative permission

Ray Tran
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 22, 2024

Hi,

I've been digging around in the post and have found that that if I use https://api.bitbucket.org/2.0/workspaces/<workspace>/permissions/repositories that I should have gotten a list of repositories and the users. However, I see that I'm only getting a partial list. I need to do an audit of our admin permission and I would like to see if it's possible to list out all the repositories and the administrators. If there is an example of how to do this in Python that is even better. Thank you in advance for your help.

We are on Bitbucket cloud if it makes a difference.

1 answer

2 votes
Jim Knepley - ReleaseTEAM
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 22, 2024

ref: https://developer.atlassian.com/cloud/bitbucket/rest/api-group-workspaces/#api-workspaces-workspace-permissions-repositories-get

If you're only getting a partial list, it's possibly because that endpoint is paginated, and you need to tell it which page (and how many records per page) you want.

pagelen defaults to 10, but you can request as many as 100, which might be enough. Otherwise you'll need to make additional requests to get the next page until you get them all.

Pagination is a fairly common pattern, you can see examples of how to interact with such APIs in Python here:

https://stackoverflow.com/questions/17777845/python-requests-arguments-dealing-with-api-pagination

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events