“Resource not found for the segment” using Graph subscription beta

百般思念 提交于 2019-12-31 03:57:28

问题


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.

From the page: https://graph.microsoft.io/en-us/docs/api-reference/beta/api/subscription_post_subscriptions

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

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

Sending in a json object like this:

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

Doing this I get the result:

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


回答1:


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).

Try changing your JSON to:

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



来源:https://stackoverflow.com/questions/42147060/resource-not-found-for-the-segment-using-graph-subscription-beta

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!