在 office365 中使用 post 请求时出现 ErrorInvalidRequest

ErrorInvalidRequest while using post request in office365

使用 restClient,我正在尝试添加一个新事件。

url: https://outlook.office365.com/ews/odata/Me/Events

我的 json 创建事件是

{"IsAllDay":false,"Subject":"TEST","Start":"2015-02-20T07:32:39Z","End":"2015-02-20T08:32:39Z","Body":{"ContentType":"HTML","Content":"TEST JRA ? TU VOIS ?"}}

我得到的回复是

{
   "error":
   {
       "code": "ErrorInvalidRequest",
       "message": "Cannot read the request body."
   }
}

我的 json 出了什么问题,我该如何解决这个错误?

确保您的内容类型是 "application/json"

我能够使请求生效。请参阅下面的示例请求和响应。

POST https://outlook.office365.com/api/v1.0/Me/Events HTTP/1.1
Authorization: <Snipped>
Content-Type: Application/Json

{
   "IsAllDay":false,
   "Subject":"TEST",
   "Start":"2015-02-20T07:32:39Z",
   "End":"2015-02-20T08:32:39Z",
   "Body":{
      "ContentType":"HTML",
      "Content":"TEST JRA ? TU VOIS ?"
    }
}