1
votes

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
What are you setting as the content-type in your validation response? Also, have you confirmed that the User in question has a valid mailbox (i.e. calling /users/{id}/mailfolders('inbox')/messages returns results)?Marc LaFleur
Hi Marc, If I run the call via Graph Explorer "graph.microsoft.com/v1.0/Users{id}/mailfolders('inbox')/messages" it returns the emails. The content type of the subscription call is application/json, and the verification is "text/plain". What I find odd is no actual request comes in from the Graph servers? However, the public server is accessible.Gavin
If it helps - here is the header of the verification response. Content-Encoding: gzip Content-Type: text/plain Date: Sun, 25 Feb 2018 09:23:32 GMT Server: ServiceNow Transfer-Encoding: chunked X-Is-Logged-In: trueGavin

1 Answers

0
votes

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?