.NET Programming
--
Questions
--
Followers
Top Experts
Post method is not accepting parameter in ASP.Net WEB API
Hi,
I have setup MVC web api application and was testing post method.
The parameter passed via postman is not captured in web api method.
Postman:

Value in .Net while debugging:

Full page code:
Please advise.
I have setup MVC web api application and was testing post method.
The parameter passed via postman is not captured in web api method.
[HttpPost]
public IHttpActionResult Post([FromBody] string filterName)
{
return new JsonResult<string>(filterName, new JsonSerializerSettings(), Encoding.UTF8, this);
}
What is wrong in passing the data.Postman:

Value in .Net while debugging:

Full page code:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using System.Web.Http.Results;
namespace webapitestweb.Controllers
{
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
[HttpPost]
public IHttpActionResult Post([FromBody] string filterName)
{
return new JsonResult<string>(filterName, new JsonSerializerSettings(), Encoding.UTF8, this);
}
// PUT api/values/5
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
}
}
Please advise.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
ASKER CERTIFIED SOLUTION
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Many Thanks






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
.NET Programming
--
Questions
--
Followers
Top Experts
The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.