AvdLee / appstoreconnect-swift-sdk

The Swift SDK to work with the App Store Connect API from Apple.
Other
1.48k stars 198 forks source link

Too Many Requests 429 #239

Closed iHTCboy closed 1 year ago

iHTCboy commented 1 year ago
The request failed with response code 429 RATE_LIMIT_EXCEEDED
The request rate limit has been reached.. We've received too many requests for this API. Please wait and try again or slow down your request rate.)

The request cannot be accepted because you have exceeded the rate limit for your API key. You will need to wait awhile and try the request again. ref: https://developer.apple.com/documentation/appstoreconnectapi/interpreting_and_handling_errors/about_the_http_status_code

Is it possible to provide an automatic retry mechanism?

AvdLee commented 1 year ago

Thanks for the suggestion, but I'm not planning to add this. I'd say this is an implementation detail for clients since there's no given standard from Apple for the API regarding retries.

iHTCboy commented 1 year ago

@AvdLee Apple response code 429 🤣

AvdLee commented 1 year ago

@iHTCboy Apple responds with a 429 which is correct, but there's no documentation on "you should retry 3 times" or similar, right? 🤔

iHTCboy commented 1 year ago

@iHTCboy Apple responds with a 429 which is correct, but there's no documentation on "you should retry 3 times" or similar, right? 🤔

Yes, Apple only said:🤣

You will need to wait awhile and try the request again.

iHTCboy commented 1 year ago

@AvdLee

https://developer.apple.com/documentation/appstoreconnectapi/identifying_rate_limits

I finally found the document🥳:

The API presents rate limits to users in an HTTP header. Every response from the API includes an X-Rate-Limit HTTP header. Its value has the form:

user-hour-lim:3500;user-hour-rem:500;