Forum Discussion
ChenguangHe
Jun 16, 2022Copper Contributor
Question about Graph API - changes notification
Hello, I'm writing a java project to create subscription to online meeting resources. I followed this instruction https://docs.microsoft.com/en-us/graph/webhooks?view=graph-rest-1.0
to construct a new subscription. This is my request:
POST https://graph.microsoft.com/beta/subscriptions
Content-Type: application/JSON
change Type": "created, updated"
"notificationUrl": "https://my.ngrok.url/notificationClient",
"resource": "/communications/onlineMeetings/{meetingID}",
"expirationDateTime": "2016-03-20T11:00:00.0000000Z",
"clientState": "SecretClientState"
And I created a project locally to receive the POST request as follow
@PostMapping(path = "/notificationClient")
public ResponseEntity<String> Notification(@PathParam ("validationToken") String opaqueTokenCreatedByMicrosoftGraph)
I should receive request from Microsoft Graph like this:
Content-Type: text/plain; charset=utf-8 POST https://{notificationUrl}?validationToken={opaqueTokenCreatedByMicrosoftGraph}
However, the validationToken I received is null. Is there anything wrong and how to create a subscription to online meeting resources?
6 Replies
Sort By
- Prasad_Das-MSFT
Microsoft
ChenguangHe - Could you please refer this sample?
Microsoft-Teams-Samples/samples/graph-change-notification at main · OfficeDev/Microsoft-Teams-Samples (github.com)- ChenguangHeCopper ContributorPrasad_Das-MSFT that project is written in nodejs, is there any Java example?
In addition, can't I just use Graph API to achieve it?- Prasad_Das-MSFT
Microsoft
ChenguangHe - There is no Java sample available for it. However, this thread discusses about similar issue. Please have a look at once which explains:
validationToken will only send to the webhook at the time of Subscription creation, after that Microsoft start sending the change notifications and there won't be any validationToken send with the change notification. This is done just to ensure that the Notification endpoint is valid/active.
Set up notifications for changes in resource data - Microsoft Graph | Microsoft Docs