Freddy
Freddy

Reputation: 521

Receiving a 429 error when iterating through data using Newman with Postman collection

New to Postman and Newman. I am iterating through a CSV data file, at times the values are few (20 or less) and at times they are great (50 or more). When iterating through large sets of values, 50 or more I receive a 429 error. Is there a way to write a retry function on a single request when the status is not 200?

I am working with the Amazon SP-API and reading through the documentation it appears as if there is nothing I can do about the x-amzn-RateLimit-Limit. My current limit is set at 5.0 I believe this is 5 requests per second.

Any advice would be helpful: a retry function, telling the requests to sleep/wait every X-amount, another method I am not aware of, etc.

This is the error I receive

{
  "errors": [
    {
      "code": "QuotaExceeded",
      "message": "You exceeded your quota for the requested resource.",
      "details": ""
    }
  ]
}

Upvotes: 0

Views: 553

Answers (1)

Freddy
Freddy

Reputation: 521

@Danny Dainton pointed me to the right place. By reading through the documentation I found out that by using options.delayRequest I am able to delay the time between requests. My final code looks like the sample below—and it works now:

newman.run({
    delayRequest: 3000,
    ...
})

Upvotes: 1

Related Questions