I need to access organization bitbucket repositories information such as commits programmatically. But I am not sure what would be the correct API for accessing an organization repository. Also, what would be the right method to access it using Python. I looked into options such as App Password and Oauth. Since I don't have the right to do Oauth since it is currently disabled in my bitbucket. Can someone please suggest how should I go about it?
Also is the below API right way to access organization's bitbucket repo
Thank you in advance.
Hi @Garima Adlakha and welcome to the community!
If you want to get a list of all repos owned by a certain workspace, you can use the following API endpoint:
In order to get all commits of a specific repo, you can use this endpoint:
An example with curl would be:
curl -u <Bitbucket_username>:<app-password> https://api.bitbucket.org/2.0/repositories/<workspace-id>/<repo-slug>/commits
As you can see in the left hand column of the above link, there are different endpoints for different repository info.
If you cannot use OAuth, you can generate an app password for your Bitbucket account, just make sure that it has appropriate permissions depending on what endpoints you are planning to use it with. You can generate an app password from this page: https://bitbucket.org/account/settings/app-passwords/
I'm not sure how you can do this using Python, but I believe that you can search whether there is a Python wrapper for Bitbucket Cloud API developed by a third party.
If you have any questions, please feel free to let me know.
Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events