简体   繁体   中英

OneNote REST API - The multi-part payload was malformed

I am working on an integration with OneNote using the REST API. I'm trying to create a note but I'm always receiving 400 response code, with the following message: "The multi-part payload was malformed."

URL:
https://www.onenote.com/api/v1.0/pages
Headers:
Content-Type: multipart/form-data; boundary=NewPart
Authorization: Bearer myToken

--NewPart
Content-Type: text/html
Content-Disposition: form-data; name="Presentation"

<!DOCTYPE html>
        <html>
          <head>
            <title>One Note test</title>
            <meta name="created" content="2014-04-13T10:36:28+01:00"/>
          </head>
          <body>
            <p>Hello OneNote World</p>
          </body>
        </html>
--NewPart--

If I try the same request in the apigee tool ( https://apigee.com/onenote/embed/console/onenote ), it's working perfectly.

I have initially tried to not use multi-part, but all the notes sent without multi-part were missing the note body on the OneNote site. Here is my post on this other issue: OneNote body is not sent when using non-multipart REST

Make sure the presentation part lines end in CRLF. We've noticed that when using some tools like Fiddler, when you try to reissue and edit a previous request, it removes the CRLF endings from the lines.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM