ValidationError when Registering Subscription with Microsoft Graph API

DemoYoom 20 Reputation points
2024-08-07T04:11:10.0166667+00:00

I am encountering a ValidationError when trying to register a subscription using the Microsoft Graph API. Below are the details of my request and the error message received:

Request:

{ 
  "changeType": "updated",
  "notificationUrl": "[my_url]",
  "resource": "sites/[my_site_id]/lists/[my_list_id]",
  "expirationDateTime": "2024-08-09T23:59:59Z",
  "clientState": "secretClientValue"
}

Error Response:

{  
  "type": "json",   
  "body": 
		{ "error": {   
			"code": "ValidationError",   
			"message": "{}",   
			"innerError": {      
				"date": "2024-08-07T03:45:50",   
				"request-id": "51747659-1766-45c6-aec2-c621ae390cc7",   
				"client-request-id": "51747659-1766-45c6-aec2-c621ae390cc7"  
		 	} 
		} 
	}, 
	"status": "failed"
}

I consider that the "message" field should include a detailed description when it is an error. Could you please assist in identifying the root cause of this validation error and provide guidance on how to resolve it?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,860 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,941 questions
{count} votes

Accepted answer
  1. Emily Du-MSFT 45,826 Reputation points Microsoft Vendor
    2024-08-08T09:22:15.54+00:00

    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

    To know how a sample notification endpoint handles this validation request, refer to the link below

    https://github.com/microsoftgraph/aspnetcore-webhooks-sample/blob/main/src/GraphWebhooks/Controllers/ListenController.cs

    Code from line 67 - 69 handles the validation request


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.