共用方式為


Supported REST operations

Applies to: Consumer notebooks on OneDrive | Enterprise notebooks on Office 365

This article lists the REST operations that you can use with the OneNote API.

Important

The API Console Service is no longer available. For more information, see We're Sunsetting Classic API Consoles.

Page operations

GET /pages

Get all pages.

GET /sections/{id}/pages

Get all pages in a specific section.

GET /sections/{id}/pages?pagelevel

Get the indentation level and order of pages in a section. GET /pages/{id}?pagelevel is also supported.

GET /pages/{id}

Get a specific page.

GET /pages/{id}/preview

Get text and image preview content for a specific page.

GET /pages/{id}/content

Get the HTML content of a specific page.

POST /pages

Create a page in the default section. (Personal notebooks on OneDrive or OneDrive for Business only)

POST /pages?sectionName

Create a page in a named section in the default notebook. (Personal notebooks on OneDrive or OneDrive for Business only)

POST /sections/{id}/pages

Create a page in a specific section.

POST /pages/{id}/copyToSection

Copy a page to a section. (Office 365 only)

PATCH /pages/{id}/content

Update the HTML content of a page.

DELETE /pages/{id}

Delete a specific page.

Warning

Using the OneNote API to delete pages is permanent. Deleted pages cannot be recovered.


Learn more about GET requests (including supported query string options) and how to create pages, update page content, and copy pages.

Section operations

GET /sections

Get all sections.

GET /notebooks/{id}/sections

Get all sections in a specific notebook.

GET /sectionGroups/{id}/sections

Get all sections in a specific section group.

GET /sections/{id}

Get a specific section.

POST /notebooks/{id}/sections

Create a section in a specific notebook.

POST /sectionGroups/{id}/sections

Create a section in a specific section group.

PATCH /sections/{id}

Change the name of a section. Send the new name using the application/json content type in the message body, like this: { "name": "New section name" }

POST /sections/{id}/copyToNotebook

Copy a section to a notebook. (Office 365 only)

POST /sections/{id}/copyToSectionGroup

Copy a section to a section group. (Office 365 only)

GET /sections/{id}/permissions

Get permissions for the section. (Office 365 only)

GET /sections/{id}/permissions/{id}

Get a specific permission for the section. (Office 365 only)

POST /sections/{id}/permissions

Create or update a permission for the section. (Office 365 only)

DELETE /sections/{id}/permissions/{id}

Delete a permission for the section. (Office 365 only)


Learn more about GET requests (including supported query string options) and how to copy sections.

Section group operations

GET /sectionGroups

Get all section groups.

GET /notebooks/{id}/sectionGroups

Get all section groups in a specific notebook.

GET /sectionGroups/{id}/sectionGroups

Get all section groups in a specific section group.

GET /sectionGroups/{id}

Get a specific section group.

POST /notebooks/{id}/sectionGroups

Create a section group in a specific notebook.

POST /sectionGroups/{id}/sectionGroups

Create a section group in a specific section group.

GET /sectiongroups/{id}/permissions

Get permissions for the section group. (Office 365 only)

GET /permissions/{id}

Get a specific permission for the section group. (Office 365 only)

POST /permissions

Create or update a permission for the section group. (Office 365 only)

DELETE /permissions/{id}

Delete a permission for the section group. (Office 365 only)


Learn more about GET requests (including supported query string options).

Notebook operations

GET /notebooks

Get all notebooks.

GET /notebooks/{id}

Get a specific notebook.

POST /notebooks

Create a notebook.

POST /notebooks/{id}/copyNotebook

Copy a notebook. (Office 365 only)

GET /notebooks/{id}/permissions

Get permissions for the notebook. (Office 365 only)

GET /permissions/{id}

Get a specific permission for the notebook. (Office 365 only)

POST /permissions

Create or update a permission for the notebook. (Office 365 only)

DELETE /permissions/{id}

Delete a permission for the notebook. (Office 365 only)


Learn more about GET requests (including supported query string options) and how to copy notebooks.

Note

Use the classNotebooks endpoint to work with class notebooks and the staffNotebooks endpoint to work with staff notebooks.

Resource operations

GET /resources/{id}/content

Get the binary content of an image or file resource.


Learn more about GET requests and how to add images and files to a page.

See also