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

How to list all repositories having secrets using bitbucket Cloud API

mhumair7 July 29, 2024

 

How to list all repositories having secrets using bitbucket Cloud API

1 answer

1 accepted

2 votes
Answer accepted
Stefano Galati July 29, 2024

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!

mhumair7 July 29, 2024

Hi @Stefano Galati Appreciate the quick help. I'll get back to you on that if needed. 

Like Stefano Galati likes this
mhumair7 July 29, 2024

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 ?

Stefano Galati July 29, 2024

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 😉

Like mhumair7 likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events