{"id":1268,"date":"2016-02-04T21:50:49","date_gmt":"2016-02-04T21:50:49","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=1268"},"modified":"2021-11-15T11:35:50","modified_gmt":"2021-11-15T19:35:50","slug":"change-page-level","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/change-page-level\/","title":{"rendered":"Change page level"},"content":{"rendered":"<p>Hi there,\nIn this Beta API update we are allowing developers to change the indentation level for a page (aka page level) programmatically.\nFor those of you who are unfamiliar with this feature, the following image shows how pages can be indented in three levels:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/01\/63\/92\/8154.page-level.png\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/01\/63\/92\/8154.page-level.png\" alt=\"\" width=\"429\" height=\"263\" border=\"0\" \/><\/a><\/p>\n<p>Here is a quick recipe for how to do this, followed by an example:<\/p>\n<ul>\n<li>Get the ID of the page for which you want to change the indentation level.<\/li>\n<li>Make sure to append the following headers to the request:\n<ul>\n<li>A valid Authorization header.<\/li>\n<li>Content-Type set to application\/json.<\/li>\n<\/ul>\n<\/li>\n<li>Use the PATCH verb.<\/li>\n<li>The URL for the API is:\u00a0<a href=\"https:\/\/www.onenote.com\/api\/beta\/me\/notes\/pages\/%7Bid\">https:\/\/www.onenote.com\/api\/beta\/me\/notes\/pages\/{id<\/a>}<\/li>\n<li>In the body of the request append the following JSON object:\n{&#8220;level&#8221;:&#8221;<strong>{page level}<\/strong>&#8220;}\nReplace\u00a0<strong>{page level}<\/strong>\u00a0with 0, 1 or 2 where 0 means no indentation at all and 2 is the maximum indentation level.<\/li>\n<li>Any response other than a 204 (HTTP no content) means that something went wrong.<\/li>\n<\/ul>\n<p>Here&#8217;s an example of what\u00a0such a request\u00a0might look like if we wanted to change the indentation level of a specific page to 1:<\/p>\n<p>PATCH\u00a0<a href=\"https:\/\/www.onenote.com\/api\/beta\/me\/notes\/pages\/1-567446387463478\">https:\/\/www.onenote.com\/api\/beta\/me\/notes\/pages\/1-567446387463478<\/a>\nContent-Type: application\/json\nAuthorization: Bearer\u00a0 eyJ0eXAiOiJKV1&#8230;<\/p>\n<p>{&#8220;level&#8221;: &#8220;1&#8221;}<\/p>\n<p>Gotchas:<\/p>\n<ul>\n<li>The indentation level for the first page in a section cannot be changed, it only works starting at the second page and onwards (if attempted, the request will fail with an HTTP status of 400).<\/li>\n<li>If the page above an indented page is moved to another location or deleted, the indented page will lose its indentation.<\/li>\n<li>The only valid values for the level property are 0, 1, 2.<\/li>\n<li>This API is still in Beta so please don&#8217;t forget the \/beta in the URL.<\/li>\n<li>Please refer to the\u00a0<a href=\"https:\/\/msdn.microsoft.com\/office\/office365\/howto\/onenote-update-page\">PATCH content API documentation<\/a>\u00a0for additional information about\u00a0PATCH APIs.<\/li>\n<\/ul>\n<p>You can use the following APIs to get the value of the current page level:<\/p>\n<p>GET\u00a0<a href=\"https:\/\/www.onenote.com\/api\/v1.0\/me\/notes\/pages\/%7Bid%7D?pagelevel=true\">https:\/\/www.onenote.com\/api\/v1.0\/me\/notes\/pages\/{id}?pagelevel=true<\/a><\/p>\n<p>Or<\/p>\n<p>GET\u00a0<a href=\"https:\/\/www.onenote.com\/api\/v1.0\/me\/notes\/sections\/%7Bid%7D\/pages?pagelevel=true\">https:\/\/www.onenote.com\/api\/v1.0\/me\/notes\/sections\/{id}\/pages?pagelevel=true<\/a><\/p>\n<p>Please note that you will have to append the pagelevel=true parameter to the request URL.<\/p>\n<p>Let us know what you think on\u00a0<a href=\"https:\/\/onenote.uservoice.com\/forums\/245490-onenote-apis\/filters\/top\">UserVoice<\/a>, contact us on twitter\u00a0<a href=\"https:\/\/twitter.com\/onenotedev\">@onenotedev<\/a>,\u00a0or ask questions tagged\u00a0<em>onenote<\/em>\u00a0on\u00a0<a href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=390182\">Stack Overflow<\/a>.<\/p>\n<p>Enjoy,\nYanir<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi there, In this Beta API update we are allowing developers to change the indentation level for a page (aka page level) programmatically. For those of you who are unfamiliar with this feature, the following image shows how pages can be indented in three levels: Here is a quick recipe for how to do this, [&hellip;]<\/p>\n","protected":false},"author":69223,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1268","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office-add-ins"],"acf":[],"blog_post_summary":"<p>Hi there, In this Beta API update we are allowing developers to change the indentation level for a page (aka page level) programmatically. For those of you who are unfamiliar with this feature, the following image shows how pages can be indented in three levels: Here is a quick recipe for how to do this, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69223"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=1268"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/1268\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=1268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=1268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=1268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}