Missed Team ’24? Catch up on announcements here.

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

Need to access organization bitbucket repositories information such as commits programmatically

Garima Adlakha March 17, 2021

Hi Team,

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
https://api.bitbucket.org/2.0/repositories/<organization_name>?q=repository.name=<repository_name>

Thank you in advance.

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 22, 2021

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.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events