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

Rate Limits of Pull Request API endpoint?

I am building a check-script på a CI-env to check for new Pull Requests and run builds for them. The problem I am facing is that I do get alot of 429 errorcodes since I bombard the API to much (multiple repos and every X time-interval).

https://confluence.atlassian.com/bitbucket/rate-limits-668173227.html does not however document how many requests I am allowed to do for the endpoint(s):

/api/2.0/repositories/${project}/${repository}/pullrequests?limit=${limit}&state=OPEN

Also the document mentions that you are locked out for an hour which is not the way I "feel" how the API responds. But rather it works again just a few seconds later.

 

Is there any better way to do these checks and/or any info on how much I will have to throttle my requests?

1 answer

1 accepted

0 votes
Answer accepted

Hi @John Lindahl

Thank you for the detailed description of your scenario.

Let me share what I know about it:

  • The 1h limit is measured by a rolling window which means that in every minute you may have back some "credits" to run new requests until the total of 1000. That explains why you are not blocked for 1h.
  • Any request to /api/2.0/repositories/... will share the same request limit of 1000 calls.
    It means that you call 500 times the /api/2.0/repositories/${project}/${repository}/pullrequest endpoint and also call 500 times the /api/2.0/repositories/{username} endpoint in less than 1h you will be blocked until the rolling window frees up some calls.
  • Each user will have a new set of limits. So you will have 1000 calls per hour for user A and also 1000 request per hour for user B. In case you have more users to run those calls this is how you could handle more calls per hour.

I hope I could clarify a little bit how the limits are set.

Please let me know if you have more questions.

Thank you for this clarification. Now I Know how to work around this.

Like Daniel Santos likes this

You are welcome!
I'm glad I could help you with this one.

We are facing the same  problem with our generic account which build the release. Is it possible to increase this rate limit just for him ? We plan to migrate to gitlab just for that.

Hi @Jérôme Fraissinet

The only way to increase the number of requests is by using an extra user and splitting the requests between the two. We can't change the limits for your account, unfortunately.

Suggest an answer

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

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

1,886 views 0 7
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