I'm writing a library to to interact with the new OneNote API.
I can do the OAuth dance with LiveConnect no problem and am POSTing a simple multipart example to prove everything works before I start adding further attachments etc
Whatever I try I always get:
Content-Length: 48
{
"Message": "Malformed multipart message"
}
The thing is, it isn't as far as I can tell.
I've gone through the request body character by character checking the headers against this document and it looks fine. I've also triple checked all the debugging suggestions in this document and I can't see what's wrong.
- I've encoded the HTML UTF-8
- I'm using a library to build the body, and a visual parse passes (see below)
- I'm posting to https://www.onenote.com/api/v1.0/pages
- Headers look OK as does the boundary, Content-type etc.
The raw request follows, is there something glaringly obvious I've missed?
POST /api/v1.0/pages HTTP/1.1
Host: www.onenote.com
User-Agent: {myLibrary}
Authorization: Bearer {mytoken}
Content-Length: 416
Content-Type: multipart/form-data; boundary=534a5a9ca709c
--534a5a9ca709c
Content-Type: text/html
Content-Disposition: form-data; name="Presentation"
<!DOCTYPE html>
<html>
<head>
<title>onenote test page</title>
<meta name="created" content="2014-04-13T10:36:28+01:00"/>
</head>
<body>
<p>Hello OneNote World</p>
</body>
</html>
--534a5a9ca709c--