问题
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 ?
回答1:
Make sure your Content-Type is "application/json"
.
回答2:
I am able to make the request work. See below for sample request and response.
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 ?"
}
}
来源:https://stackoverflow.com/questions/28623878/errorinvalidrequest-while-using-post-request-in-office365