端点:POST https://graph.microsoft.com/v1.0/me/onenote/sections/{section-id}/pages
请求头: 键:内容类型值:多部分/表单数据;边界=MyAppPartBoundary
请求正文: --MyAppPartBoundary 内容处置:表单数据;名称=“演示文稿” 内容类型:text/html
/*<!DOCTYPE html>
<html>
<head>
<title>A page with an image: Image binary data</title>
<meta name="created" value="2015-11-11T12:45:00.000-8:00"/>
</head>
<body>
<p>This page displays the uploaded image.</p>
<img src="name:image-block-name" alt="a cool image" width="500">
</body>
</html>
--MyAppPartBoundary
Content-Disposition:表单数据;名称=“我的应用程序图片Id” 内容类型:图像/jpeg
...9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQ...
--MyAppPartBoundary--*/
回复预览: { “错误”: { “代码”:“20011”, "message": "多部分有效负载格式错误。", “内部错误”:{ “日期”:“2023-11-20T13:59:19”, “请求ID”:“df177375-fe0e-46f4-b871-367fa0d7a144”, “客户端请求ID”:“da2ecc33-a170-262b-a124-a688e7025889” } } }
我试图更新图像的二进制数据(base64),但它继续显示相同的错误,请让我知道我哪里出错了。
我刚刚尝试了你的代码。
您需要将
-
-MyAppPartBoundary Content-Disposition: form-data; name="Presentation" Content-Type: text/html
--MyAppPartBoundary<br>
Content-Disposition: form-data; name="Presentation"<br>
Content-Type: text/html
和
--MyAppPartBoundary
Content-Disposition: form-data; name="MyAppPictureId" Content-Type: image/jpeg
到
--MyAppPartBoundary<br>
Content-Disposition: form-data; name="MyAppPictureId"<br>
Content-Type: image/jpeg
还要确保您使用 CRLF 作为换行符。基本上,API 对行距非常挑剔。