3

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.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Pooja Dhannawat
  • 263
  • 2
  • 8

2 Answers2

2

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.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • In case if I have lot of attachments and images in onenote page and I want to retrieve all of them so it's not suggested to process them paralley ? – Pooja Dhannawat Nov 10 '17 at 04:18
  • You can certainly do it in parallel but you'll want to limit it to 5 or less concurrent threads. – Marc LaFleur Nov 10 '17 at 16:18
0

https://blogs.msdn.microsoft.com/onenotedev/2016/01/12/onenote-api-throttling-and-how-to-avoid-it/

This blog post contains more information about how to avoid throttling from OneNote endpoints (and how it works).

Jorge Aguirre
  • 2,787
  • 3
  • 20
  • 27
  • In this blogs I could see two things 1)Limits will be based on the number requests classified by App and User - This means if your app is not following our best practices and ends up issuing too many requests to the OneNote API in a short period of time, it might be throttled for some time. 2)the limits are scoped per app and user This seems bit confusing to me – Pooja Dhannawat Nov 10 '17 at 04:20
  • it means that if the limit is X per minute, you can issue X per minute requests for a particular user, as well as X per minute for another particular user, but not 2X for the same user. – Jorge Aguirre Nov 10 '17 at 18:23
  • Any idea on what is the limit for number of calls per user. – Pooja Dhannawat Nov 12 '17 at 02:53