[英]OneNote REST API - The multi-part payload was malformed
I am working on an integration with OneNote using the REST API. 我正在使用REST API与OneNote进行集成。 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." 我试图创建一个注释,但始终收到400条响应代码,并显示以下消息:“多部分有效载荷格式错误。”
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. 如果我在apigee工具( https://apigee.com/onenote/embed/console/onenote )中尝试相同的请求,则它运行良好。
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. 最初,我尝试不使用多部分内容,但是所有发送的不包含多部分内容的注释都缺少OneNote网站上的注释主体。 Here is my post on this other issue: OneNote body is not sent when using non-multipart REST 这是我关于其他问题的文章: 使用非多部分REST时不会发送OneNote正文
Make sure the presentation part lines end in CRLF. 确保演示文稿的零件行以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. 我们注意到,当使用诸如Fiddler之类的工具时,当您尝试重新发出并编辑先前的请求时,它会从行中删除CRLF结尾。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.