Share via


New APIs Available: Create Notebooks and Sections

We are happy to announce that we have just turned on the ability create notebooks and sections through the OneNote API. These new APIs are very straight-forward to use, and here are some examples.

Creating a new Notebook

To create a new notebook called “Fall 2014 Semester”, simply make the following HTTP request:

POST https://www.onenote.com/api/v1.0/notebooks

Headers:
Content-Type: application/json // Make sure you include these headers!
Authorization: Bearer <access_token>

Body:
{ name: “Fall 2014 Semester” }

And that’s it. Here is a sample response:

 201 Created
 {
   "@odata.context": "https://www.onenote.com/api/v1.0/$metadata#notebooks/$entity",
   "isDefault": false,
   "userRole": "Owner",
   "lastModifiedBy": "James Lau",
   "isShared": false,
   "sectionsUrl": "https://www.onenote.com/api/v1.0/notebooks/0-61528580FB755FBB!460/sections",
   "sectionGroupsUrl": "https://www.onenote.com/api/v1.0/notebooks/0-61528580FB755FBB!460/sectionGroups",
   "links": {
     "oneNoteClientUrl": {
       "href": "onenote:https://d.docs.live.net/61528580fb755fbb/Documents/Fall%202014%20Semester"
     },
     "oneNoteWebUrl": {
       "href": "https://onedrive.live.com/redir.aspx?cid=61528580fb755fbb&page=edit&resid=61528580FB755FBB!460"
     }
   },
   "id": "0-61528580FB755FBB!460",
   "name": "Fall 2014 Semester",
   "self": "https://www.onenote.com/api/v1.0/notebooks/0-61528580FB755FBB!460",
   "createdBy": "James Lau",
   "lastModifiedBy": "James Lau",
   "createdTime": "2014-07-29T19:08:49.987Z",
   "lastModifiedTime": "2014-07-29T19:08:49.987Z"
 }

Creating a new Section

Creating a new section is similarly easy. Let’s create a new section called “BIOLOGY 101” in the notebook that we just created. In this case, we will use the “id” property above (0-61528580FB755FBB!460) as the {notebookId} below.

POST https://www.onenote.com/api/v1.0/notebooks/{notebookId}/sections

Headers:
Content-Type: application/json // Make sure you include these headers!
Authorization: Bearer <access_token>

Body:
{ name: “BIOLOGY 101” }

Voila! And here is the response we get back:

 201 Created
 {
   "@odata.context": "https://www.onenote.com/api/v1.0/$metadata#sections/$entity",
   "isDefault": false,
   "pagesUrl": "https://www.onenote.com/api/v1.0/sections/0-61528580FB755FBB!462/pages",
   "id": "0-61528580FB755FBB!462",
   "name": "BIOLOGY 101",
   "self": "https://www.onenote.com/api/v1.0/sections/0-61528580FB755FBB!462",
   "createdBy": "James Lau",
   "createdTime": "2014-07-29T19:10:51.573Z",
   "lastModifiedTime": "2014-07-29T19:10:51.673Z"
 }
  

Create New Notebook on OneNote Online

With the launch of these new APIs, we have also just turned on the ability to create new notebooks on OneNote Online. This is a feature that has been requested by many of our users. Now that it is available, the OneNote Online experience is more convenient to use than ever before.

Note that we are using the exact same API as the one we are providing to our developer community. We are happy to be making this feature and the API available to you simultaneously.

create_notebook

Documentation

You can find the reference documentation from the links below:

With that, we are also marking 2 items on UserVoice as completed (Create section API and Create notebook API).

That’s it. You can also play with these API from our interactive console as usual.

Happy coding!

- James (@jmslau)

Comments

  • Anonymous
    August 04, 2014
    Do we have the ability to add content to an existing notebook using these new API??

  • Anonymous
    August 06, 2014
    As someone who predates the 8080 chip, I am excited to see that OneNote is becoming the best note application available. Keep up the good work.

  • Anonymous
    August 06, 2014
    Yes, you can create pages in specific notebook/section. Please read this post for more info: blogs.msdn.com/.../create-page-in-specific-location-now-in-beta.aspx

  • Anonymous
    June 23, 2015
    I lost a note that I needed. it wont let me get it back. Can you help me ?