Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph Calendar API - TargetIdShouldNotBeMeOrWhitespace error

We use Microsoft Graph API's to create a calendar in outlook

Following is the HTTP Request

POST https://graph.microsoft.com/v1.0/users/me/calendars
Content-type: application/json

{
  "name": "My Calendar"
}

It was working for the last 2 years. Suddenly it is throwing an error as

{
  "error": {
    "code": "TargetIdShouldNotBeMeOrWhitespace",
    "message": "Id is malformed.",
    "innerError": {
      "request-id": "78bce863-d6fb-4ea9-b0f8-e5097010cef6",
      "date": "2019-03-23T11:54:34"
    }
  }
}

When we searched the documentation (https://learn.microsoft.com/en-us/graph/api/user-post-calendars?view=graph-rest-1.0). We found the API URL has been changed

  1. When was a critical update like this was rolled out which caused breakage in our flows?

  2. Is there any official channel/group notifying these changes.

similar question for mail API's Microsoft Graph API - SendMail http 400 - API url from documentation not working

like image 641
Hari Prasandh Avatar asked Mar 25 '19 07:03

Hari Prasandh


1 Answers

The correct URI is /me, not /users/me. Behind the scenes, /me is just an alias for /users/{id}. Asking for /users/me would be the equivalent of asking for /users/users/me.

It sounds like you were making use of an unintended behavior. It stopped working when that behavior was corrected.

like image 183
Marc LaFleur Avatar answered Nov 25 '22 20:11

Marc LaFleur