How to list all repositories having secrets using bitbucket Cloud API
Hi @mhumair7
You can’t directly use the Bitbucket Cloud API to list all repositories with secrets. The API doesn’t provide a specific endpoint for that. But, you can list all repositories and then check each one for secrets in the pipeline environment variables. Here’s the API to list repositories:
https://api.bitbucket.org/2.0/repositories/{username}
Want me to whip up a Python script (or any other language) to automate the process of checking each repository for secrets? Let me know, and I’ll get on it!
Hi @Stefano Galati Appreciate the quick help. I'll get back to you on that if needed.
Just a side question though @Stefano Galati . Is there a way to export meta data like pull requests and stuff in a given workspace or project from Bitbucket Cloud ?
Sure thing, @mhumair7 ! You can export metadata like pull requests and other details from a given workspace or project in Bitbucket Cloud.
Here are the main steps:
Use the API to List Repositories with a get tonretrieve a list of all repositories in the workspace.
GET https://api.bitbucket.org/2.0/repositories/{workspace}
After that fetch Pull Requests for all repos
GET https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pullrequests
Then export other metadata like commits, issues, etc., by using their respective API endpoints.
Like before if you need help with thé code let me know 😉
It looks like you're new here. Sign in or register to get started.