Receiving validation error when trying to create a webhook subscription

Steve Norwood 0 Reputation points

I've been testing various ways to create a webhook subscription (with resource data), and I'm getting a ValidationError with no details as to what the issue is.

I am developing in C#, and I have tested this using the Microsoft.Graph NuGet package and through a plain HttpClient.

This is the error I am getting:

    "error": {
        "code": "ValidationError",
        "message": "\"Validation: Testing client application reachability for subscription Request-Id: bd78c77c-fcdc-4ed2-9a95-ea9e704380ed\"",
        "innerError": {
            "date": "2024-06-28T11:21:49",
            "request-id": "bd78c77c-fcdc-4ed2-9a95-ea9e704380ed",
            "client-request-id": "bd78c77c-fcdc-4ed2-9a95-ea9e704380ed"

The error message says nothing, because the message is just the validation token I am sending. I have been using DevTunnels in Visual Studio, and I have also tested this with ngrok.

When I test this in Postman by sending the same validation token, "Validation: Testing client application reachability for subscription Request-Id: cdf5239b-8137-4a79-bada-8cdd1ac2fdf". I can also confirm that the Content-Type of the response is text/plain and it is returning a 200 OK response.

Please can someone who has access have a look at my request using the error and tell me what I am doing wrong, as the response I am getting tells me nothing. Thanks!

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,316 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,604 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 50,911 Reputation points

    Please provide us the request you're sending. You are not passing correct data and the request is failing. But since we cannot see what endpoint you're calling and therefore what data is needed vs what you're sending then we have no way of figuring out where you're code is incorrect.

  2. Steve Norwood 0 Reputation points

    I did not realise this question got posted, as I got a message saying my content had been deleted!

    I asked the question on Stack Overflow here, and have posted the answer there. It boiled down to text/plain not quite behaving in my C# code.

    While I was returning the result as text/plain, behind the scenes in the code, it was adding an extra set of quotation marks around the token, which seemed to invalidate the request. This surprised me as the docs state that the response has to "contain" the validation code, and not equal it exactly. Nevertheless, I have got it working now, after fixing the text/plain issue and ensuring I was returning the validation code exactly as it had been sent (after url decoding of course)

    0 comments No comments