Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Test Rail API - HTTP 429 Too many requests


#1

Hello

We are using Test Rail API.
When we have new tests we are using scripts to create test suites and test cases online in TestRail.

Mostly we are using:
add_case
add_section

But after adding few test cases we are getting HTTP 429 ( Too man requests) response.
So we added some sleeps between sending requests, which helped. But than we got bigger suites and we again faced HTTP 429 at the end of suite.
Well we have solved this by adding yet more wait time.

I am just curious if we are doing something wrong? Or if it’s correct behavior from the API server.

  • We are using Python API and Cloud hosted TestRail

Thank you


#2

It’s correct behavior, see http://docs.gurock.com/testrail-api2/introduction, Rate Limit section.
You can use the Retry-After response header to determine required sleep duration.


#3

Maybe an ideal place to expose the issue early on, would be to demonstrate an example in the API Binding files. A lot of people might not be considering to implement the solution right away as they read the introduction, because no one knows what the rate limits are!


#4

Hi everyone,

Yes, if you see a 429, then just wait for the number of seconds you see in the Retry-After header in the response. There’s some rate-limiting for the API with TestRail Cloud if you process a lot of requests but you can simply throttle your requests a bit if you encounter a 429. The exact limit of requests per minute depends on several factors (e.g. GET vs POST).

Cheers,
Tobias