Search code examples
apirestoffice365rest-client

ErrorInvalidRequest while using post request in office365


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 ?


Solution

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