Search code examples
outlookmicrosoft-graph-apioutlook-restapimicrosoft-graph-calendar

Microsoft Graph API UnableToDeserializePostBody 400 error


I'm trying to create recurring events under my outlook calendar and for that, I'm following instructions from here.

My payload looks like this:

{
  "Subject": "Blocked By DEV",
  "Body": {},
  "Start": {
      "DateTime": "2022-08-30T23:30:00",
      "TimeZone": "Asia/Calcutta"
  },
  "End": {
      "DateTime": "2022-08-30T23:45:00",
      "TimeZone": "Asia/Calcutta"
  },
  "Recurrence": {
      "pattern": {
          "type": "WEEKLY",
          "interval": 1,
          "daysOfWeek": [
              "Monday",
              "Tuesday"
          ]
      },
      "range": {
          "type": "numbered",
          "startDate": "2022-08-30",
          "numberOfOccurences": 3
      }
  }
}

I'm trying to hit the endpoint /me/events from Graph Explorer and getting this 400 error.

{
    "error": {
        "code": "UnableToDeserializePostBody",
        "message": "were unable to deserialize "
    }
}

Is there anything wrong with my payload? Is there any way to have more details about the failure?


Solution

  • Just spotted the culprit, numberOfOccurences was supposed to be numberOfOccurrences.

    And if someone asks why I ended up doing that mistake, I just referred docs, and seems like official documentation has that typo.