0

I asked this question on the OneNote Dev Blog, http://blogs.msdn.com/b/onenotedev/archive/2016/01/13/onenote-api-throttling-and-best-practices.aspx - and Jorge suggested asking it again here.

I am able to create multiple Notebooks with the REST API using the
POST ...beta/me/notes/notebooks/{master notebook}/copynotebook
the calls are very fast.

Adding pages with
POST ...beta/me/notes/pages/{template page}/copyToSection
works fine and allows me to get the pageID.

This all works as expected until the number of notebooks gets over what seems like a small number of notebooks may be less than 50. After this any command to get pageIDs such as GET .../beta/me/notes/sections/{sectionID}/pages?top=100"
results in multiple "502 Bad Gateway" responses and occassionally gets through after looping for 10-15 minutes waiting for a "200 OK".

When the notebook count gets to about 100 all page calls fail either in my php script, Fiddler or Microsoft Graph Explorer. Deleting the Notebooks returns functionality.

I know there is a 5000 Notebook limit, but is there a lower limit for pages API functionality (sections and notebook calls continue to work). Is it possible to select only a subset of Notebooks to be "active" to reduce the overhead on the API call?

My workaround at present (that I'm experiementing with) is to use the OneDrive API to download or move the NoteBooks out of OneDrive to accomplish the same thing - is there another approach?

codeye
  • 607
  • 3
  • 10
  • Can you share a CorrelationId (HTTP header) of any of the successful requests so we can lookup subsequent data and find a root cause for te 502's? – Jorge Aguirre Jan 25 '16 at 19:08
  • Hi Jorge. Here you go. X-CorrelationId: aa2a1068-683b-4fd2-9417-3754e10110f4 – codeye Jan 26 '16 at 01:19
  • I've just started getting this 502 Bad Gateway error with a simple 3 note GET request in a dev app that had functioned numerous times without issue (first time 15 min before timestamp of this comment). Adding 'FavorDataRecency: true' to the request header did nothing. – Velojet Mar 08 '16 at 01:10
  • [17 hours later] All functioning again, as smoothly as before, with no changes in my code. Some issue on the OneNote API backend? – Velojet Mar 08 '16 at 19:03
  • [21 hrs later] This 502 Bad Gateway error is back : ( - again with no changes in my OneNote API GET code. Inevitable conclusion seems to be some issue on the OneNote API backend. – Velojet Mar 08 '16 at 23:10
  • [23 hrs later] Functioning again! What gives? – Velojet Mar 09 '16 at 04:18
  • Experiencing this now myself. The following command: ~/pages?$filter=contains(tolower(parentNotebook/name),'-we')&$expand=parentSection,parentNotebook&$count=true&$top=100 with ***FavorDataRecency:true*** no longer returns a result, even an error and just hangs my script – codeye Nov 28 '16 at 15:47

2 Answers2

1

If your scenario involves invoking the GET ~/sections/{id}/pages API when you have a large number of sections, we currently recommend adding the below header to your API request.

FavorDataRecency: true

  • 2
    This should be considered a bug. – Evert Jan 27 '16 at 02:10
  • Thanks Manoj, adding **FavorDataRecency:true** fixes the problem, requests that were taking >=120 sec are now completed in ~10 sec. Is there a downside to adding the header? Cheers Steve – codeye Jan 27 '16 at 12:13
0

1. In your knowledge, how many pages you had created under the section you are querying from? 2. Also how many sections per notebook (on average you created)? 3. Also provide the correlation Id (from the response) for such a request with date, time, time zone of making this request.

There is, however, no limit on the number of pages.

  • Hi Sharad, 1.I first query against a section that is empty in a "master" notebook. 2.The notebooks I am generating contain 7 sections each time (6 generated from copying from the "master" notebook and 1 added with the patient name - this last section comes from a "template page" in a second notebook and is then renamed). 3.I don't receive a correlation Id, here is a typical response HTTP\/1.1 502 Bad Gateway Server: Microsoft-IIS\/8.5 X-Powered-By: ASP.NET Date: Mon, 25 Jan 2016 13:39:25 GMT Content-Length: 0 – codeye Jan 25 '16 at 18:18