ErrorInvalidRequest而使用office365 POST请求 [英] ErrorInvalidRequest while using post request in office365

查看:375
本文介绍了ErrorInvalidRequest而使用office365 POST请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用RESTClient实现

,我想添加一个新的事件。

 网​​址:https://outlook.office365.com/ews/odata/Me/Events

我为创建一个事件的JSON是

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

我得到的回应是

  {
   错误:
   {
       code:ErrorInvalidRequest
       消息:无法读取请求主体。
   }
}

什么是错我的JSON,如何解决这个问题?


解决方案

请确保您的内容类型为应用/ JSON

using restClient, I am trying to add a new event.

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

My json for the creation of an event is

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

The response I get is

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

What is wrong with my json and how do I solve this error ?

解决方案

Make sure your Content-Type is "application/json".

这篇关于ErrorInvalidRequest而使用office365 POST请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆