title: ASP.Net Core 3.1 - Post parameter is always NULL in Web API
body: <p>I am trying to create a basic API service in ASP.Net Core 3.1.</p>
  <p>Before going to the problem description, I have already gone through these questions-</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/10984040/post-parameter-is-always-null?page=2&amp;tab=votes#tab-top">Post parameter is always null</a></li>
  <li><a href="https://stackoverflow.com/questions/39748153/asp-net-core-post-parameter-is-always-null">Asp.net Core Post parameter is always null</a></li>
  <li><a href="https://stackoverflow.com/questions/41798814/asp-net-core-api-post-parameter-is-always-null">ASP.NET Core API POST parameter is always null</a></li>
  <li><a href="https://stackoverflow.com/questions/14624306/web-api-parameter-always-null">Web Api Parameter always null</a></li>
  <li><a href="https://stackoverflow.com/questions/22741943/web-api-post-body-object-always-null">web-api POST body object always null</a></li>
  </ul>
  <p>but, none of fixing my issue.</p>
  <p>What I am trying to do is create a basic API which will take a <code>string</code> from the API then use the <code>string</code> and give a response based on the string. What I am doing is like this in <code>Controller</code>-</p>
  <pre><code>[Route(&quot;/&quot;)]
  [ApiController]
  [EnableCors]
  public class XmlValidatorController : ControllerBase
  {
      ........................
      ........................
  
  [HttpPost(&quot;verify_string&quot;)]
  public ActionResult&lt;ICollection&lt;Certificate&gt;&gt; VerifyXmlString([FromQuery(Name = &quot;xml&quot;)] string xml)
  //string xml                                =&gt; Giving Null
  //[FromQuery(Name = &quot;xml&quot;)] string xml      =&gt; Giving Null
  //[FromBody] string xml                     =&gt; Unsupported Media Type - 415
  //[FromBody] dynamic xml                    =&gt; Unsupported Media Type - 415
  //HttpRequestMessage msg                    =&gt; Unsupported Media Type - 415
  {
      ...............
      ...............
  }
  </code></pre>
  <p>If I am creating a <code>POST</code> request from <a href="https://www.postman.com/" rel="nofollow noreferrer"><code>POST Man</code></a>, I am creating like this-</p>
  <p><a href="https://i.stack.imgur.com/P5SHS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P5SHS.png" alt="Header Postman" /></a></p>
  <p>and</p>
  <p><a href="https://i.stack.imgur.com/HVU6g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HVU6g.png" alt="body postman" /></a></p>
  <p>In my controller, if I am putting a debugging pointer, I am getting this-</p>
  <p><a href="https://i.stack.imgur.com/iD6Ux.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iD6Ux.png" alt="Controller" /></a></p>
  <p>So, I am always getting <code>null</code> in <code>POST</code> request.</p>
  <p>If I use others in the function parameter, I am getting this errors-</p>
  <ul>
  <li>string xml                                =&gt; Giving Null</li>
  <li>[FromQuery(Name = &quot;xml&quot;)] string xml      =&gt; Giving Null</li>
  <li>[FromQuery(Name = &quot;xml&quot;)] string xml      =&gt; Giving Null</li>
  <li>[FromBody] string xml                     =&gt; Unsupported Media Type - 415</li>
  <li>[FromBody] dynamic xml                    =&gt; Unsupported Media Type - 415</li>
  <li>HttpRequestMessage msg                    =&gt; Unsupported Media Type - 415</li>
  </ul>
  <p>Can anyone please help me find the parameter string from the Controller action paramenter/ function parameter (XML).</p>
  <h2>Re-</h2>
  <p>I haven't tried with creating a model for the request because I think it will make the code a little more complex and that become overkill as I need just a string.</p>
  <h2>Re-re-</h2>
  <p>My <code>Startup.cs</code> file has no special configuration, it is default code provided during code creation. The code for the file can be found in <a href="https://github.com/AbrarJahin/BCC-CA-XMLSignVerifierService/blob/master/Startup.cs" rel="nofollow noreferrer">here</a>. And code for controller can be found in <a href="https://github.com/AbrarJahin/BCC-CA-XMLSignVerifierService/blob/master/Controllers/XmlValidatorController.cs" rel="nofollow noreferrer">here</a>.</p>
  <p>Complete Codebase can be found in <em><strong><a href="https://github.com/AbrarJahin/BCC-CA-XMLSignVerifierService" rel="nofollow noreferrer">this Github Repo</a></strong></em>.</p>
  <p>Thanks in advance for helping.</p>