Creating a subscription gives ValidationError: The request is invalid due to validation error

Toon Dubois 20 Reputation points
2024-05-31T11:53:59.66+00:00

I currently have a developer tenant with 5 rooms and would like to have a subscription on the events of these rooms so I can notify my API that a meeting has been created.

This way, I wouldn't have to constantly retrieve all meetings whenever someone needs the meetings of 1 room.

This is the current post request that I send to the MSGraph API:

https://graph.microsoft.com/v1.0/subscriptions

Bearer token included

Body:

{
    "changeType":"created",
    "notificationUrl":"https://myOwnAPI/public/notify/M05",
    "lifecycleNotificationUrl":"https://myOwnAPI/public/subscriptions/refresh",
    "resource":"/users/userIdOfRoomM05/events",
    "expirationDateTime":"2024-05-31T19:10:22.4572326Z",
    "clientState":"secretClientValue"
}

I currently receive:

{
    "error": {
        "code": "ValidationError",
        "message": "The request is invalid due to validation error.",
        "innerError": {
            "date": "2024-05-31T11:30:37",
            "request-id": "cbd2c67a-fb35-46bb-9d46-29ee7d8b536a",
            "client-request-id": "cbd2c67a-fb35-46bb-9d46-29ee7d8b536a"
        }
    }
}

as a response. I can retrieve and read all meetings.

I have also tried to make this subscription on Graph explorer, but I get the same response there as well.

Both the NotificationUrl and LifecycleNotificationUrl work on their own when using postman.

Microsoft Security Microsoft Graph
{count} votes

Accepted answer
  1. Anonymous
    2024-06-03T06:54:33.59+00:00

    Hi @Toon Dubois

    The validation error suggests that your notification URL is not able to respond to an endpoint validation request send by Microsoft.

    Your notification endpoint should have provision for reading the validation token from the query parameters and return it back immediately.

    User's image

    Follow this link for more information:

    https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-1.0&tabs=http#notification-endpoint-validation

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.