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

Bitbucket REST API Rate Limiting ?

I'm downloading a list of commits through the Bitbucket REST API, and I'm running into the flowing message:

AppError: Rate limit for this resource has been exceeded.

There is information on the rate limits here: https://confluence.atlassian.com/bitbucket/rate-limits-668173227.html

However, there isn't a lot of information around how they work, when they reset, or what the timeout is. I would like to modify my download script in a way that can download the full list of commits, while still respecting the limits.

2 answers

I may be missing something, but rather than using the API could you clone the entire repo and extract the list of commits locally?

I'm not able to find an endpoint to clone the repository from the OAuth Credentials.

Sean Conaty Atlassian Team Jun 04, 2019

I realize that this is a year late, but in case anyone lands here, you can use an oauth access token to clone repos as described on this page: https://developer.atlassian.com/bitbucket/api/2/reference/meta/authentication

Repository Cloning

Since add-ons will not be able to upload their own SSH keys to clone with, access tokens can be used as Basic HTTP Auth credentials to clone securely over HTTPS. This is much like GitHub, yet slightly different:

$ git clone https://x-token-auth:{access_token}@bitbucket.org/user/repo.git

The literal string x-token-auth as a substitute for username is required (note the difference with GitHub where the actual token is in the username field).

Like Jeremy Freeman likes this

Thanks for that @Sean Conaty I had since found this, and have started using it.  

0 votes
Ana Retamal Atlassian Team Feb 28, 2018

Hi Jeremy, rate limits are divided into one hour windows for both authenticated and unauthenticated requests. To obtain a list of repository commits, the rate is 1,000 requests per hour. Once you reach it you'll need to wait until 1 hour has passed so you can continue sending requests.

Hope this clarifies!

Ana

So, does that mean If I make 1000 requests from 9:45 to 9:59, I can then make 1000 more requests from 10:01-10:15.

Is the one hour window based on clock time? is it a rolling count? Does it start with the last request?

My workload is bursty, so, I would like some clarification around how it's calculated to better prepare for this.

Hi Jeremy, 

It's the rolling count I believe , not by clock hour. 

Cheers.

Yana

Thanks!  Is there no official documentation on this behavior, aside from the above link?

Hi Jeremy, 

The document linked above is what we have available right now. 

If you do get more questions or need clarification on anything please do get in touch via the community or raise a support ticket with us.

Cheers.

Yana

I'm responding to this to add to the documentation.  My tests confirmed that it's a rolling count.

Like # people like this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

4,093 views 4 22
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