OneNote API error and warning codes
Find explanations for error and warning codes returned by the Microsoft OneNote API.
Last modified: January 22, 2016
Applies to: OneNote service
Note
|
|---|
|
See this topic on our new documentation site for consumer and enterprise OneNote APIs. |
This topic describes error and warning codes that are returned by the OneNote API whenever a request sent through the API fails.
The codes are broadly organized into categories that correspond to ranges of code numbers. The following table lists each category and its corresponding number range.
|
Code number range |
Category |
|---|---|
|
10001-19999 |
Service problems or service information. |
|
20001-29999 |
Developer or application-based errors. |
|
30001-39999 |
User-based errors |
|
40001-49999 |
Authentication and authorization failures |
When your request generates an error, the OneNote API stops performing the request and returns an error response as a JSON object. An error response contains the associated error code, a message, and a link to the appropriate section of this article. The following example shows how an error response looks.
{
"error":{
"code":"10002",
"message":"The service is currently unavailable. Please try again later.",
"@api.url":"http://go.microsoft.com/fwlink/?LinkID=400805"
}
}
When your request generates a warning, the OneNote API performs the request and includes the warning in its response. A response can contain more than one warning, so the API returns warnings as an array of JSON objects. Each warning contains a message and a link to the appropriate section of this article. The following example shows how a warning response looks in the context of a completed request.
{
"@odata.context":"https://www.onenote.com/api/v1.0/$metadata#me/notes/notebooks",
"api.diagnostics@odata.type":"#Collection(Microsoft.OneNote.Api.Diagnostic)",
"@api.diagnostics":[
{
"message":"Created date/time string 5/5/2014 in 'Presentation' part html did not match any of the allowed formats",
"url":"http://go.microsoft.com/fwlink/?LinkID=400816"
}
],
"value":[
{
"isDefault":false,
"createdBy":null,
"modifiedTime":"0001-01-01T00:00:00Z",
"userRole":"Owner",
"id":"55C9F7CBFC6AC1!76345",
"name":"Notebook1",
"link":null
},
{
"isDefault":true,
"createdBy":null,
"modifiedTime":"0001-01-01T00:00:00Z",
"userRole":"Owner",
"id":"55C9F7CBFC6AC1!76428",
"name":"Notebook2",
"link":null
},
{
"isDefault":false,
"createdBy":null,
"modifiedTime":"0001-01-01T00:00:00Z",
"userRole":"Owner",
"id":"55C9F7CBFC6AC1!77509",
"name":"Notebook3",
"link":null
}
]
}
A request can also generate both an error and one or more warnings. In that case the OneNote API stops performing the request and returns both the error and the warnings. The following example shows how an error that contains a warning looks.
{
"error":{
"code":"10002",
"message":"The service is currently unavailable. Please try again later.",
"@api.url":"http://go.microsoft.com/fwlink/?LinkID=400805",
"api.diagnostics@odata.type":"#Collection(Microsoft.OneNote.Api.Diagnostic)",
"@api.diagnostics":[
{
"message":"Created date/time string 5/5/2014 in 'Presentation' part html did not match any of the allowed formats",
"url":"http://go.microsoft.com/fwlink/?LinkID=400816"
}
]
}
}
The service is having problems or is sending information to the application.
10001
An unexpected error occurred and the request failed.
10002
The service is not currently available.
10003
The current user’s account has exceeded the maximum number of active requests. Your app will have to repeat the request.
10004
The service can’t create a page in the requested section because that section is protected by a password.
10005
The request contains more than the maximum number of image tags in which the data-render-src attribute contains a PDF. See Capture and embed PDF files with the OneNote API for more information.
10006
The OneNote API was unable to create a page in the specified section because that section is corrupt.
10007
The server is too busy to handle the incoming request at this moment. Please try again later.
10008
The user's OneDrive, Group, or Document Library contains more than 5000 items. The OneNote API cannot process the query until some items are removed.
19999
The request failed because an undetermined error occurred.
The application code has done something wrong.
20001
The request is missing the required "Presentation" part. Exactly one is required. See OneNote API reference for more information.
20002
The request contains two or more "Presentation" parts. Exactly one is required. See OneNote API reference for more information.
20003
The content type of the "Presentation" part can be only text/html or application/xhtml+xml. See OneNote API reference for more information.
20004
The "Presentation" part HTML contains an image tag with both the src and the data-render-src properties set. The API will ignore the src property and use the data-render-src property. See OneNote API reference for more information.
20005
The request URI is too long. The maximum size of the URI (including all parameters and data) is 16 kb or 16,384 characters.
20006
The "Presentation" part HTML contains an image tag with neither the src nor the data-render-src properties set. The API will ignore the image tag. See OneNote API reference for more information.
20007
The "Presentation" part HTML contains a created date/time string that does not match any of the allowed formats. See OneNote API reference for more information.
20008
The size of the request is too large. See OneNote API reference for more information.
20009
The request contains parts with duplicate names. Part names must be unique. See OneNote API reference for more information on how to construct multi-part requests.
20010
The Content-Disposition header was not supplied for the specified content type. See OneNote API reference for more information on how to construct multi-part requests.
20011
The request contains a malformed multi-part payload. Problems could include missing blank lines, a missing last line, incorrectly formatted part separators, and so on. If you're building the multi-part message by hand, carefully check the logic, or consider using a third-party library. See OneNote API reference for more information on how to construct a multi-part payload.
20012
The request doesn’t supply a content type for the specified part. See OneNote API reference for more information on how to construct a part.
20013
The request doesn’t supply Content-Type and Content-Disposition headers for the specified part.
20014
The length of a part in the multi-part message exceeds the maximum size of 25 MB. See OneNote API reference for more information.
20015
The count of parts in the multi-part message exceeds the limit of 500. See OneNote API reference for more information.
20016
The length of the multi-part message exceeds the limit of 75 MB. See OneNote API reference for more information.
20100
Something is wrong with the syntax of your request. See OneNote API reference for more information, and check to make sure that you have constructed your request correctly.
20101
The property that you requested doesn’t exist.
20102
You requested a resource that doesn’t exist.
20104
The pagelevel query option is supported only when querying for the pages collection in a section or for a specific page. For example:
GET ../sections/{id}/pages?pagelevel=true
GET ../pages/{id}?pagelevel=true
20106
Your request contains a query operator that is not supported. See OneNote API reference for more information.
20108
Your request contains unsupported OData query parameters.
20109
The payload in the PATCH request is not constructed correctly.
20110
Page create requests with data parts require the content to be multi-part, with a "Presentation" part. See OneNote API reference for more information.
20111
Your request uses an OData feature that isn’t supported.
20112
Your request contains an invalid ID for the target notebook, section group, section, or page entity.
20113
The resource specified in the request has been deleted.
20115
The name contains invalid characters. A notebook name cannot contain any of the following characters: ?*\/:<>|'"
20117
An item with the name you specified already exists in the location that you specified.
20119
The HTML in the 'Presentation' part contains a data-attachment attribute that either doesn’t have a valid format or includes one or more of these invalid characters for a file name: \/:*?<>|". The request substituted the value indicated in the error message.
20120
Your request specifies a PATCH target that can’t be located.
20121
Your request contains an invalid PATCH argument. See Update page content.
20122
Your request specifies an unsupported PATCH action. See Update page content.
20123
The PATCH request is unable to alter the specified page.
20124
Your multi-part PATCH request doesn’t include a 'commands' part with the PATCH action JSON structure. See Update page content.
20125
Your PATCH request contains no actions. See Update page content.
20126
The message body contains either incorrectly formatted JSON or fields that are not supported for this operation.
20127
Your request specifies the name of an unknown property.
20128
Your request contains an OData syntax error at the position indicated in the message.
20129
Your request contains a $top query whose value is too high. The maximum value is 100. For GET /pages requests, the default value is 20. See Get OneNote content and structure
20130
Your request contains a URI that points to an HTTP resource that can’t be found.
20131
Your request contains an invalid value for Content-Type. Use the value indicated in the message. See OneNote API reference for more information.
20132
Your request contains invalid content. Common causes for this are a missing Content-Type request header and/or no content in the body of the request. See OneNote API reference for more information.
20133
Your request specifies a PATCH target that is not supported. See Update page content.
20134
Your request specifies an invalid element as the target of the PATCH action. If the target uses the data-id identifier, make sure it's prefixed with a # symbol. See Update page content.
20135
Your request specifies an entity type that is not supported for the PATCH operation.
20136
Your request contains an invalid or missing data-render-src or data-render-method attribute. See Enrich captured content with the OneNote API.
20137
The target page does not support PATCH requests.
20138
The target element type in your PATCH request doesn't support the append action. See Update page content.
20139
Your request contains an invalid data-tag attribute value. See Use note tags.
20140
Your request contains an invalid data-tag status value. Checkbox note tags can have a completed status. Example:
<p data-tag="to-do:completed">To-do note tag in completed state (checked box in the UI)</p>
20141
The target in your PATCH request doesn't support the specified action. See Update page content.
20142
Your request contains an expand expression for a parent of child entities or a child of parent entities, which is not supported. See Supported OData query options.
20143
The OData query is invalid.
20144
Your request contains an expand expression for a non-navigation property. Only navigation properties can be expanded.
20145
The select or expand expression in your request contains an invalid term.
20146
The style="position:absolute" attribute is specified on an element, but the body element does not specify data-absolute-enabled="true", which is required to support positioning. All position settings will be ignored. See Create pages with absolutely positioned elements.
20147
The style="position:absolute" attribute is specified on an element that is not a direct child of the body element, which is not supported. If the element is a div, img, or object, make it a direct child of the body; otherwise the position settings will be ignored and its content will render inside an absolutely positioned div. See Create pages with absolutely positioned elements.
20148
The style="position:absolute" attribute is specified on an element type that does not support it. Only div, img, and object elements that are direct children of the page body support positioning. See Create pages with absolutely positioned elements.
20149
Your request specifies a target element that cannot be found.
20150
The request is not valid for this authentication type. Use the ../me/notes/ path instead.
20151
The request is not valid for this authentication type. Use the ../me/notes/section/{id}/pages endpoint to create a page in a specific section.
20152
There is no name value specified for the entity. The name must be defined, and it cannot contain whitespaces only.
20153
The entity name contains invalid characters. The name cannot contain the following characters: ?*\/:<>|&#''%~
20154
The entity name cannot start with a space.
20155
The entity name is too long. Notebook names have a 128-character limit. Other entity names have a 50-character limit.
20156
The specified ID for the destination resource does not exist.
20157
The specified ID for the destination entity is invalid.
20158
Unable to get metadata for the site URL specified in the request. Check the format of the supplied URL. Supported formats include https://domain.sharepoint.com/site-a and https://domain.com/sites/site-a. (SharePoint support is in Preview.)
20159
The new page is not fully created yet. Your call will succeed after the page has been fully created.
20161
The context does not specify a valid user ID. One common error is that PUID/CID was passed in as a long instead of a hex.
Something is wrong with the user’s account.
30101
The user account has exceeded its OneDrive quota. See Microsoft OneDrive for more information.
30102
Nothing more can be added to the requested section because it has reached its maximum size.
30103
The level of resource consumption is too high. Either the target user account has a large dataset or the service is receiving a high number of concurrent requests to the same site (for example, the user's personal site or a team site).
30104
The user account has been suspended.
30105
The user's personal OneDrive for Business site is not provisioned, which is required to access notebooks. The OneNote service will provision the site now. This process may take several minutes.
30106
OneDrive for Business is being provisioned for the user.
30108
The user's OneDrive for Business could not be retrieved.
The user or application does not have the correct permissions.
40001
The request doesn’t contain a valid OAuth token. See Get a client ID for use with the OneNote API and Authenticate the user for the OneNote API for more information.
40002
The user doesn’t have permission to write to the requested location.
40003
The user doesn’t have permission to get access to the requested resource.
40004
The OAuth token doesn’t have the required scopes to perform the requested action. See Authenticate the user for the OneNote API for more information.
In addition to the standard HTTP response codes, the OneNote API returns headers to the calling app. Included in every response is an X-CorrelationId header and a Date header, as shown in the following example.
X-CorrelationId: d2d6aaf5-3bde-4ee7-ba18-27727bf3cffe Date: Fri, 06 Mar 2015 15:10:46 GMT
Your app can log the correlation ID and date of your API calls. You can use these values if you need to work with Microsoft support to resolve problems in your app or with the API.
Note |
|---|
The correlation ID is a GUID that ties together the various pieces in the backend servers. Correlation IDs are not sequential, which means you can't use them to establish an order of page creation. |
Note