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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need to access organization bitbucket repositories information such as commits programmatically

Edited

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

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
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

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...

3,925 views 10 16
Read article

Community Events

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

Events near you