“未找到该段的资源"使用 Graph 订阅测试版 [英] "Resource not found for the segment" using Graph subscription beta

查看:30
本文介绍了“未找到该段的资源"使用 Graph 订阅测试版的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft Graph 获取具有应用程序权限的日历事件.它完美地工作.现在我试图设置一个订阅来监听事件变化,但是普通的 v1.0 不支持这个.然而,至少在描述中,beta 版说它可以工作.

Im using the Microsoft Graph to get calendar event with application permission. It works perfectly. Now Im trying to set up a subscription to listen to event changes however the normal v1.0 do not suport this. However beta, at least in the description, say it works.

来自页面:https://graph.microsoft.io/en-us/docs/api-reference/beta/api/subscription_post_subscriptions

注意:/beta 端点允许应用程序权限作为大多数资源的预览功能."

"Note: the /beta endpoint allows Application permissions as a preview feature for most resources."

所以我用 URL 尝试了这个:https://graph.microsoft.com/beta/subscriptions

So I tried this with the URL: https://graph.microsoft.com/beta/subscriptions

像这样发送一个 json 对象:

Sending in a json object like this:

{"changeType":"创建、更新、删除","notificationUrl":"https%3A%2F%2FXXX.com%2Fo365.php","资源":"%2Fusers%2Foooom%40xxx.com%2Fevents","clientState":"1486588355561","expirationDateTime":"2018-11-20T18:23:45.9356913Z"}

{ "changeType":"created,updated,deleted", "notificationUrl":"https%3A%2F%2FXXX.com%2Fo365.php", "resource":"%2Fusers%2Fooom%40xxx.com%2Fevents", "clientState":"1486588355561", "expirationDateTime":"2018-11-20T18:23:45.9356913Z" }

这样做我得到了结果:

{错误": {"code": "BadRequest","message": "未找到段 '/users/room@xxx.com/events' 的资源.",内部错误":{请求 ID":d9ca58b1-ee1f-4072-81d5-0f1a25dcdd45",日期":2017-02-08T21:26:51"}}}

{ "error": { "code": "BadRequest", "message": "Resource not found for the segment '/users/room@xxx.com/events'.", "innerError": { "request-id": "d9ca58b1-ee1f-4072-81d5-0f1a25dcdd45", "date": "2017-02-08T21:26:51" } } }

我已经尝试了资源中的所有类型的组合,但无法使其正常工作.有人知道如何做到这一点吗?

I have tried all types of combos in the resource but cant get it to work. Anybody that have an idea on how to do this?

推荐答案

json属性的值不需要url编码.该资源也不需要用户"前面的/"(尽管这不是导致您的问题的原因).

The value of json properties don't need to be url encoded. The resource also doesn't need a '/' in front of "users" (although this isn't what is causing your issue).

尝试将您的 JSON 更改为:

Try changing your JSON to:

{"changeType":"创建、更新、删除","notificationUrl":"https://myurl.com/o365.php",资源":用户/person@myemail.com/events","clientState":"1486588355561","expirationDateTime":"2018-11-20T18:23:45.9356913Z"}

{ "changeType":"created,updated,deleted", "notificationUrl":"https://myurl.com/o365.php", "resource":"users/person@myemail.com/events", "clientState":"1486588355561", "expirationDateTime":"2018-11-20T18:23:45.9356913Z" }

如果这不能解决问题,请随时回复.

Feel free to respond back if this doesn't address the issue.

这篇关于“未找到该段的资源"使用 Graph 订阅测试版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆