dvelopp
dvelopp

Reputation: 4315

Microsoft Graph API gives InternalServerError on subscribe request

I'm currently moving from Outlook API to Microsoft Graph API and when I try to subscribe to push notifications for calendars and events as I did for Outlook and I get an error:

{
"error": {
"code": "InternalServerError",
"message": "Object reference not set to an instance of an object.",
"innerError": {
  "request-id": "130ef895-4741-472e-9155-73fcb38a487f",
  "date": "2017-07-14T11:40:11"
}
}
}

To authenticate I use end-point:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize

When I send a request to:

https://graph.microsoft.com/v1.0/subscriptions

{
"id": null,
"resource": "users/me/events/calendars/{calendarId}/events",
"notificationUrl": "https://myapp:8080/MyService/notifications/",
"clientState": null,
"@odata.type": null,
"@odata.id": null,
"@odata.context": null,
"changeType": "created,updated,deleted",
"expirationDateTime": "2017-07-19T11:40:10Z"
}

I found several cases with the same error, but they were totally in a different area(not subscriptions). What can be wrong here? I tried to follow this question: "Resource not found for the segment" using Graph subscription beta , However, the solution doesn't work in my case.

Upvotes: 2

Views: 402

Answers (2)

David Sterling - MSFT
David Sterling - MSFT

Reputation: 580

From your HTTP response, can you give me the X-BEServer HTTP response header value along with the request id and date time for one of these null ref error responses? That way I can pull logs and see what is going on.

Upvotes: 1

Jason Johnston
Jason Johnston

Reputation: 17702

Remove all of the fields in the payload that you set to null. Make your payload like this:

{
  "resource": "users/me/events/calendars/{calendarId}/events",
  "notificationUrl": "https://myapp:8080/MyService/notifications/",
  "changeType": "created,updated,deleted",
  "expirationDateTime": "2017-07-19T11:40:10Z"
}

Upvotes: 2

Related Questions