Note: using the same PATCH request as defined in Onenote API (REST) - PATCH append - "must include a 'commands'" error when Commands is already supplied (?!)
Each PATCH request is an append operation, and uses the following layout supplied to |HTML| in my code:
<div>
<h1>Hardcoded_Name_ForNow</h1>
<h3>4.345054</h3>
<p>sdfsdfsdf</p>
<img src="name:image-part-name" alt="New binary image" />
</div>
However, when I GET the content of the page (ref: https://jsapi.apiary.io/apis/onenote/reference/get-pages/v10pagesid/get.html?console=1), it turns out like this:
(HEADER OMITTED)
<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
<div style="width:624px">
<h1 style="font-size:16pt;color:#1e4e79;margin-top:11pt;margin-bottom:11pt">Hardcoded_Name_ForNow</h1>
<h3 style="font-size:12pt;color:#5b9bd5;margin-top:11pt;margin-bottom:11pt">47.77527</h3>
<p>TEST</p>
<img alt="New binary image" width="624" height="353" src="https://www.onenote.com/api/v1.0/resources/0-60a8d03c70a04372ad60cabb8191f86d!1-6C3CB48828A4FCE7!185/$value" data-src-type="image/png" data-fullres-src="https://www.onenote.com/api/v1.0/resources/0-60a8d03c70a04372ad60cabb8191f86d!1-6C3CB48828A4FCE7!185/$value" data-fullres-src-type="image/png" />
<h1 style="font-size:16pt;color:#1e4e79;margin-top:11pt;margin-bottom:11pt">Hardcoded_Name_ForNow</h1>
<h3 style="font-size:12pt;color:#5b9bd5;margin-top:11pt;margin-bottom:11pt">41.16911</h3>
<p>ewqeqweqweqew</p>
<img alt="New binary image" width="624" height="353" src="https://www.onenote.com/api/v1.0/resources/0-9d9ab7935d16464eb826e70dd7fdb3ef!1-6C3CB48828A4FCE7!185/$value" data-src-type="image/png" data-fullres-src="https://www.onenote.com/api/v1.0/resources/0-9d9ab7935d16464eb826e70dd7fdb3ef!1-6C3CB48828A4FCE7!185/$value" data-fullres-src-type="image/png" />
...
</div>
</body>
I know that if I didn't supply a specific target ID, the PATCH request will target the topmost . However, I expected the PATCH request to throw in the layout wholesale without stripping the encapsulator.
Currently working around it by assuming h1, h3, p, img will always be in order, but this is harder to maintain if the tag order changes or new tags are added.
Enabling div id attributes doesn't help, the are simply not there in the first place.