API RateLimit 1000 per hour reached
pheeling opened this issue · 2 comments
What should Sync Execution do If error 403 Forbidden retry xx in seconds happens?
Probably suiting function:
https://www.thomasmaurer.ch/2010/07/powershell-simple-retry-logic/
with feature of secounds read out.
try to create 1000 requests to get error
In PowerShell 6, Invoke-RestMethod has a "ReponseHeadersVariable" parameter for this. Unfortunately, it isn't available in 5.1 and earlier, so the workaround as already mentioned is to use Invoke-WebRequest.
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Ratelimit-Total: 3000
X-Ratelimit-Remaining: 998
X-Ratelimit-Used-CurrentRequest: 1
X-Freshservice-Api-Version: latest=v2; requested=v2
HEADER NAME | DESCRIPTION |
---|---|
X-RateLimit-Total | Total number of API calls allowed per hour. |
X-RateLimit-Remaining | The number of requests remaining in the current rate limit window. |
X-RateLimit-Used-CurrentRequest | The number of API calls consumed by the current request. Most API requests consume one call, however, including additional information in the response will consume more calls. |
Retry-After | The number in seconds that you will have to wait to fire your next API request. This header will be returned only when the rate limit has been reached. |
HTTP/1.1 429
Content-Type: application/json; charset=utf-8
Retry-After: 1521