I have been tasked with writing Http POST
method to process incoming webhook data and I have been able to achieve that but to actually start receiving I have to first subscribe to Webhook event by validating the url and for that I also have to capture query string parameter passed in POST
request which is where I am having issues.
Below method signature is able to capture header and body and then implementation processes the data.
[HttpPost]
public IActionResult Callback([FromHeader(Name = "headerSignature")] string signature, [FromBody] WebHookEventData eventData)
However I also need to enable this to capture data coming from query string. For example below is the url with query string and when I pass that as POST
request from Postman it throws error 415 unsupported media type:
https://webhoook.example.com/webhook/callback?centre.challenge=test
How do I capture query parameter in POST
request?
Simple you can use HttpContext like this:
and if you like to Address a special QueryString do it this way :
Hope it helps ;)