问题
We are creating a Webhook/Subscription using Microsoft Graph. However, the following JSON is returned and we can see no corresponding HTTP request to our validation public web server:
"error": {
"code": "InvalidRequest",
"message": "Subscription validation request failed. Must respond with 200 OK to this request.",
"innerError": {
"request-id": "d2c4eeca-1bf9-4657-a904-ba6925428bbd",
"date": "2018-02-24T17:19:56"
}
}
Our HTTP POST request to https://graph.microsoft.com/v1.0/subscriptions contains this JSON:
{
"changeType": "created,updated",
"clientState": "subscription-identifier",
"expirationDateTime": "2018-02-27T15:46:18.835Z",
"notificationUrl": "https://[public_web_server]/api/watl/o365",
"resource": "Users/[email address]/mailfolders('inbox')/messages"
}
When testing the request via Hurl.it and other online HTTP requests we can see the request hit our web server. However, we can not see anything coming from Microsoft Graph.
Our web server is responding with a 200 OK and including the ValidationToken as the body.
Any suggestions?
回答1:
The error seems to be happening because the notification URL provided in the request payload does not accept media type "text/plain". Can you make the change and try again?
来源:https://stackoverflow.com/questions/48965662/webhook-not-performing-subscription-validation