none
ERROR : Cannot read the request body while creating new calendar event api. RRS feed

  • Question

  • Hi, 

    I was trying to create and update the calendar event using [POST] https://outlook.office365.com/api/v1.0/me/events and [PATCH] https://outlook.office365.com/api/v1.0/me/events/<eventId> respectively.

    When i try with poster or postman, I get this error

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

    its not working . Any help will be appreciated.

    Note: GET events and DELETE Events are working. I think the API with payload is not working.

    Test Data :

    URL: https://outlook.office365.com/api/v1.0/me/events/
    Method: POST
    JSON Data(Payload):
    {
      "Subject": "Discuss the Calendar REST API",
      "Body": {
        "ContentType": "HTML",
        "Content": "I think it will meet our requirements!"
      },
      "Start": "2015-01-06T07:03:07.481Z",
      "End": "2015-01-05T07:03:07.481Z",
      "Attendees": [
        {
          "EmailAddress": {
            "Address": "deepakv@intelligrape.com",
            "Name": "Konveen"
          },
          "Type": "Required"
        }
      ]

    Error:
    {
        "error": {
            "code": "ErrorInvalidRequest",
            "message": "Cannot read the request body."
        }
    }
    Monday, January 5, 2015 7:24 AM

All replies

  • Hi Sahil,

    I was able to make your request work fine against my Office 365 mailbox with 2 changes.

    1. Can you please make sure you are adding header "Content-Type: Application/Json"?

    2. Can you please make sure your end time is AFTER start time?  Looks like there is a typo with your current request as the start time is on 2015-01-06 and end time is on 2015-01-05.

    Hope that helps ...

    Thanks,
    Venkat

    Monday, January 5, 2015 1:32 PM
  • Hi Venkat,

    Thanks for replying :)

    I missed the "Content-Type" : "Application/Json"  in headers. Its working now :)

    Thanks for the help.

    Regards

    Sahil

    Tuesday, January 6, 2015 6:23 AM