Monday 13 May 2024

OrderCloud Webhook model validation

We had an issue recently where we were seeing (during local testing using VS dev tunnels) that our webhook endpoint was being called but returning a 400 response, indicating that there was a model binding error (using OrderCalculatePayload).  Of course the response is being returned, but as it's being called by OrderCloud it's not actually visible to us :'(

Frustratingly, even bumping up the logging does not actually show you what the issue is, however there is a great bunch of answers in the ASP.NET Core docs issues page which does provide the necessary info. Just chuck this in your Program.cs and either set a breakpoint inside it or check your console logs.  You should be able to see exactly which property of your model (likely xp as it was in our case) is not populated as expected by the webhook call! 

No comments:

Post a Comment