I created a WebAPI with Visual Studio 2017 using its .Net Core template. I am able to test my Get() code with Postman and everything works correctly. Now, I would like to send a Post request so it calls the following code.
[HttpPost]
public void Post([FromBody] string value)
{
Console.WriteLine("value" + value);
}
However, I get the following error when call
https://localhost:44364/api/carbon?value=100
{
"": [
"A non-empty request body is required."
]
}
I am sure the problem lies with they way my Postman is setup but it looks correct.

Any suggestions? Thank you!
Updated per suggestion
I added key/value to the body and received "The input was not valid."

You do not need to use Query string.You need to post the string with raw json, and do not forget the double quotation marks.Refer to here to get more details on post methods by Postman.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With