I am creating a business event which is sent to an HTTPS endpoint (webApi in azure)
When I create the endpoint in D365 after publishing my WebApi using the following function signature, the D365 endpoint creation works succesfully:
app.MapPost(//myendpoint/, () =>
{
app.Logger.LogInformation($/MessageReceived!/);
return Results.Ok();
});
However, I want to add validation and a payload to my endpoint, like so:
app.MapPost(//myendpoint/, async (IValidator<CustomerFilesBusinessEvent> validator, MyDataClass data)
Now when I locally run my WebApi project I can perfectly POST make succesful calls to the endpoint using Postman, so the payload I send there is correct.
However, after publishing this revision of my WebApi, editing the business event endpoint in D365 does not work and it returns a 400 Bad request.
I figure that this is logical, because the D365 could never know what payload the HTTPS endpoint of the webApi would expect.
So I figured I can now only test my business event by sending an actual business event with the correct payload.
(since the endpoint had already been created when the function was still published WITHOUT payload)
So I sent a business event via D365, but it runs into error, saying:
The webhook call failed because the http request received non-success httpStatus code. Please check your webhook request handler.
So now I have 2 questions:
-1. Is my assumption correct that you could never test an HTTPS endpoint via D365 that contains payload, since D365 could never know what payload to send along in it's test?
-2. How can I find out why the business event runs into error? I am sending the exact same data along as payload as I sent via postman