Debug and handle errors with the OneNote API
Use the information in this topic to troubleshoot errors returned by the Microsoft OneNote API.
Last modified: April 18, 2014
Applies to: OneNote service
In this article
HTTP error codes
Causes for common errors
Helpful debugging tools
X-CorrelationId header
This topic lists the HTTP status codes that the OneNote API returns. To help you debug your app, we've also listed common causes for API-related errors you might see in your apps. We've included links to some useful tools that have helped us debug our own apps, and provided information about the X-CorrelationId header returned by the API.
The Microsoft OneNote API is REST-based, and so is built on top of HTTP. The API doesn't return all the possible HTTP error codes listed in RFC 2616 standard or in this excellent list on Wikipedia. Instead, the OneNote API returns the status codes in the following table. Some errors return more explanation in the response body, but not all of them do. If you're having trouble getting your app to work, check the next section for ideas about what might be causing the errors.
|
HTTP Status Code |
|---|
|
201 - Created The POST request succeeded in creating the new page. This is the default success result from the pages POST request. Some processes, like OCR, can take a few moments to process, so your app might receive the 201 status before the data becomes available in OneNote. |
|
400 - Bad Request A syntax or other error was detected in a request your app sent. |
|
401 - Unauthorized Problems occurred in authenticating the token, user or your app. |
|
413 - Request Entity Too Large The request was larger than the API can process. |
|
415 - Unsupported Media Type The request entity has a media type which the server or resource does not support. |
|
500 - Internal Server Error A generic error message, given when an unexpected condition was encountered and no more specific message is suitable. |
Below are some possible causes for errors returned by the OneNote API:
-
413 - Request entity too large
-
Part or request sizing issues The OneNote API limits the amount of data in a request to 70 MB maximum.
-
-
415 - Unsupported media type
-
Content-Type is not compatible with the OneNote API. Verify that the content type is compatible with the API, and is not misspelled.
-
-
500 - Internal server error
The developer world has many platform-specific debugging tools, often included with the IDE or SDKs, in the device emulators, and so on. The following are a few that we've found helpful:
-
Network monitoring tools can sometimes help resolve issues by showing exactly what's going over the wire between your app and the OneNote API. We've used Fiddler on Windows, and they have an early Mono-based Mac version. WireShark is also a popular tool.
-
Device emulators provide an environment where you can try your code on devices you don't own, and without having to load it onto the physical device. When developing Android, iOS and Windows Phone apps that use the API, you should be able to access the API without problems from device emulators.
Opening the native OneNote clients from a Windows Phone or Android phone emulator can have problems, however. If you're trying to use the oneNoteClientURL links in either the Windows Phone or Android phone emulators, be sure to read the topic Open the OneNote clients with the OneNote API.
For more information, see Get tools and libraries to use with the OneNote API.
In addition to the standard HTTP response codes, the OneNote API returns headers to the calling app. Included with every response is an X-CorrelationId header, with a GUID value, that looks like this.
X-CorrelationId : d2d6aaf5-3bde-4ee7-ba18-27727bf3cffe
The CorrelationId header ties together the various pieces in the backend servers. Your app can log this GUID value when you need to work with Microsoft support to resolve problems in your app or the API. The values are not sequential, which means you can't use them to establish an order of page creation.