简体   繁体   中英

OneNote REST API - How to deal with a “502 Bad Gateway” error?

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM