【问题标题】:Microsoft Graph API gives InternalServerError on subscribe requestMicrosoft Graph API 在订阅请求时提供 InternalServerError
【发布时间】:2017-07-14 11:58:48
【问题描述】:

我目前正在从 Outlook API 迁移到 Microsoft Graph API,当我尝试订阅日历和事件的推送通知时,就像我在 Outlook 中所做的那样,我得到了一个错误:

{
"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"
}
}
}

为了验证我使用端点:

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

当我发送请求时:

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"
}

我发现了几个具有相同错误的案例,但它们完全在不同的区域(不是订阅)。这里有什么问题? 我试图关注这个问题:"Resource not found for the segment" using Graph subscription beta,但是,该解决方案不适用于我的情况。

【问题讨论】:

  • 您是否尝试过在负载中省略所有设置为 null 的字段?所以基本上只发resourcenotificationUrlchangeTypeexpirationDateTime?
  • 谢谢!这有助于“资源”:“me/calendars/{calendarId}/events”,但是当我尝试订阅日历中的更改(添加/删除/更新日历)时,仍然有相同的问题和相同的消息。我尝试了资源:我/日历和我/事件。根据文档,它应该可以工作:developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/…
  • 你能用问题请求更新你的问题吗?
  • 问题是在第二个请求中我没有删除空字段之一。感谢你的回答。您可以将其添加为答案,我会接受。

标签: java outlook microsoft-graph-api office365api


【解决方案1】:

删除负载中您设置为null 的所有字段。像这样制作你的有效载荷:

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

【讨论】:

    【解决方案2】:

    从您的 HTTP 响应中,您能否给我 X-BEServer HTTP 响应标头值以及这些 null ref 错误响应之一的请求 ID 和日期时间?这样我就可以提取日志并查看发生了什么。

    【讨论】:

    • 谢谢!那个是固定的。不再有日志。
    猜你喜欢
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-07
    • 1970-01-01
    • 2019-06-05
    • 2018-02-01
    相关资源
    最近更新 更多