I need to configure a route such as https://example.com./api/NotesApi/WebHook/pix
, to receive a HTTP POST
request from a third party API. My site is ASP.NET Webforms running on .NET 4.6.1. Global.asax
looks like this, under app_start
:
RouteTable.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{action}/{id}", New With {Key .id = System.Web.Http.RouteParameter.[Optional])
And then in the NotesApiController.vb
I have
Public Sub WebHook(ByVal request As HttpRequestMessage)
Dim json = request.Content.ReadAsStringAsync().Result
...
End Sub
I tested that I can trigger this method by sending a post to
https://example.com./api/NotesApi/WebHook
but the API sends the request to
https://example.com./api/NotesApi/WebHook/pix
and I have no idea how to configure this /pix
part in the controller. Appreciate any help
2
Answers
Ok, so I finally got it working by applying the good ole Trial 'n Error method:
You can try this: