title: 415 Unsupported Media Type; Angular to ASP.Net Core API
body: <p>I have <code>ASP.Net Core 2.1 API</code>. It looks as below.</p>
  
  <pre><code>[HttpPost]
  public async Task&lt;IActionResult&gt; Post([FromBody]string email) {
  
  }
  </code></pre>
  
  <p>When calling from the postman, I had to call the above API as below with the header set as <code>Content-Type = application/json</code></p>
  
  <p><a href="https://i.stack.imgur.com/dHRzM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dHRzM.png" alt="enter image description here"></a></p>
  
  <p>While calling the same API from  <code>Angular 8</code> app.</p>
  
  <pre><code>public send(email: string) {
     //other tried option #1 let obj = JSON.stringify(email);
     //other tried option #2 let obj = this.http.post(API.Url, {email});
     /other tried option #3 let obj = 
  
     return this.http.post(API.Url, email).pipe(
        retry(2)
     );
  }
  </code></pre>
  
  <p>This is throwing the below error:-</p>
  
  <blockquote>
    <p>415 Unsupported Media Type;</p>
  </blockquote>
  
  <p>If the call is updated with headers:-</p>
  
  <pre><code>/* httpOptions = new HttpHeaders({
      'Content-Type': 'application/json'
  }*/
  public send(email: string) {
   return this.http.post(API.User, email , httpOptions).pipe(
    retry(2)
  );}
  </code></pre>
  
  <p>It throws the error as </p>
  
  <blockquote>
    <p>{"":["Unexpected character encountered while parsing value: c. Path '', line 1, position 1."]}</p>
  </blockquote>
  
  <p>How do I call the above API which is accepting a single parameter named email from angular?</p>
  
  <p>Thanks!</p>