gpt4 book ai didi

java - Microsoft Graph API 在订阅请求时给出 InternalServerError

转载 作者:行者123 更新时间:2023-11-30 07:53:06 25 4
gpt4 key购买 nike

我目前正在从 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 的所有字段。像这样制作你的有效负载:

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

关于java - Microsoft Graph API 在订阅请求时给出 InternalServerError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45102429/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com