I am using Microsoft Graph for OneNote. I have observed few issues with these endpoints. Sometimes when API's are called concurrently a throttling exception is thrown (HTTP 429
). And suddenly next API call returns successful response.
As per documentation, a Retry-After
field will be returned in the response header along with HTTP 429
when throttling is active but I have never received this field in the response header.
Is there any other way to get the wait time?
How long I should wait to further avoid this issue? This is a blocker issue for me. Kindly help.
The documentation should be more clearer and note that not all endpoints return a Retry-After
. This is because not all endpoints throttle using the same rules.
Some endpoints, such as Exchange, throttle based on a formula that looks at the number of requests within a window time. These endpoints respond with Retry-After
to alert you how long you have to wait before you have a new window.
Other endpoints simply throttle based on the number concurrent requests. OneNote is one of these endpoints. Rather than looking at requests over time, it simply limits you to a maximum of 5 concurrent calls. Since throttling isn't dependent on time, it would be impossible to provide a Retry-After
value.
This is also why you so often see your initial retry succeed, it means some previous call had completed and there were now 5 or less concurrent requests.