title: Why POST using a 'Form' vs using a 'Body'?
body: <p>The title expresses my post succinctly.  Though the following side-note expresses my specific situation which sparked the question.</p>
  
  <blockquote>
    <p>*Side Note:  I'm making a web app with an Angular Front-end.  I've found that once I encapsulate my data in a 'FormData' object from an
    html form template, I am then unable to get those values back from
    within client-side Angular (as posts like this one state:
    <a href="https://stackoverflow.com/questions/22404476/how-do-i-get-the-content-from-a-formdata">How do i get the content from a formData?</a>
    ).  Though when I POST to ASP.Net with a '[FromForm]' attribute the
    values get mapped fine.</p>
    
    <p>So to make things easier I might rather acquire data from the form in
    the first place and then use it in a 'body' POST instead of a 'form'
    POST.  Doing this so that I am passing around straight data I can work
    with, instead of data wrapped in a form which I'm unable to work with
    client-side.</p>
    
    <p>So, thus, I'm wondering the differences between Posting 'forms' and
    posting 'bodies', and whether there's any reason I should use one over
    the other?</p>
    
    <p><strong>Update</strong></p>
    
    <p>In ASP.Net Core you can put attributes on your parameter types for REST endpoints.  [FromForm] and [FromBody] are what I'm curious about.  On the angular side, calling these REST endpoints requires passing either a 'FormData' (for the [FromForm]), or some sort of user defined type (for [FromBody]).</p>
    
    <p>See below for examples.</p>
  </blockquote>
  
  <p><strong>Update</strong></p>
  
  <p>Here's the signature for the ASP.NET Endpoint for the '[FromBody]':</p>
  
  <pre><code>[HttpPost]
  public async Task&lt;IActionResult&gt; CreateToken([FromBody] LoginViewModel model) 
  {...}
  </code></pre>
  
  <p>Here's the Angular snippet that calls this '[FromBody]' endpoint, along with the type that is passed in for the POST call:</p>
  
  <pre><code>public creds = {
      username: "",
      password: ""
  }
  
  login(creds): Observable&lt;boolean&gt; {
  return this.http.post("api/account/createtoken", creds)
    .pipe(
      map((data: any) =&gt; {
        this.token = data.token;
        this.tokenExpiration = data.expiration;
        this.username = data.username;
        return true;
      }));
  }
  </code></pre>
  
  <p>Here is the signature for the ASP.NET Endpoint for the '[FromForm]':</p>
  
  <pre><code>[HttpPost]
  public async Task&lt;IActionResult&gt; Signup([FromForm] SignupViewModel viewModel)
  {...}
  </code></pre>
  
  <p>and here is the Angular snippet that calls this '[FromForm]' endpoint:</p>
  
  <pre><code>registerUser(formData: FormData) {
      const options = {
        headers: new HttpHeaders().set('Accept', 'application/json')
      };
      return this.http.post('api/account/signup', formData, options)
        .pipe(
        map(() =&gt; {
            return true;
          }),
          catchError(this.handleError)
        );
  }
  </code></pre>