Microsoft Graph API请求正文不起作用

用户名

developer.microsoft.com/en-us/graph/graph-explorerI上,我尝试在OneNote中发布创建页面请求,并且在请求标头中填充的默认代码如下所示:

KEY: Content-type       VALUE: multipart/form-data
     boundary                  MyPartBoundary198374

请求主体如下所示:

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

<!DOCTYPE html>
<html>
  <head>
    <title>A page with <i>rendered</i> images and an <b>attached</b> file</title>
    <meta name="created" content="2015-07-22T09:00:00-08:00" />
  </head>
  <body>
    <p>Here's an image from an online source:</p>
    <img src="http://..." alt="an image on the page" width="500" />
    <p>Here's an image uploaded as binary data:</p>
    <img src="name:imageBlock1" alt="an image on the page" width="300" />
    <p>Here's a file attachment:</p>
    <object data-attachment="FileName.pdf" data="name:fileBlock1" type="application/pdf" />
  </body>
</html>

--MyPartBoundary198374
Content-Disposition:form-data; name="imageBlock1"
Content-Type:image/jpeg

... binary image data ...

--MyPartBoundary198374
Content-Disposition:form-data; name="fileBlock1"
Content-Type:application/pdf

... binary file data ...

--MyPartBoundary198374--

响应预览仍然给我一个错误,说:

Page create requests require the content to be multipart, with a presentation part.

考虑到请求标头和请求主体是由Microsoft生成的,这不应该吗?我有正确的section-id可以写到页面,所以我很困惑。

用户名

我所缺少的是在请求标头中,而不是将其值multipart/form-data更改为text/html

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章