0

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

enter image description here

How do I capture query parameter in POST request?

1 Answer 1

0

Simple you can use HttpContext like this:

var queryString = HttpContext.Request.QueryString ;

and if you like to Address a special QueryString do it this way :

var queryStringId = HttpContext.Request.Query["id"] ;

Hope it helps ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.