title: Customizing Web API Controller Parameters
body: <p>We have a Web API Controller generated from a model. The model has this form:</p>
  
  <pre><code>public class Pdf
  {
      public int ID { get; set; }
      public string Name { get; set; }
      public string Url { get; set; } // File stored in AWS
      public int Job_ID { get; set; }
      public List&lt;PdfPage&gt; { get; set; }
  }
  </code></pre>
  
  <p>The automatically generated controller has this default POST route:</p>
  
  <pre><code>// POST: api/Pdfs
  [ResponseType(typeof(Pdf))]
  public async Task&lt;IHttpActionResult&gt; PostPdf(Pdf pdf)
  {
      if (!ModelState.IsValid)
      {
          return BadRequest(ModelState);
      }
  
      db.JobFiles.Add(pdf);
      await db.SaveChangesAsync();
  
      return CreatedAtRoute("DefaultApi", new { id = pdf.ID }, pdf);
  }
  </code></pre>
  
  <p>In making a new <code>Pdf</code>, however, the file itself is put in AWS. In the case of hitting this route, where we're making a new <code>Pdf</code>, we want to make a new PDF that will be uploaded to AWS. In order to do that, we want to pass additional parameters to the route that don't exist in the model. Something like this:</p>
  
  <pre><code>// POST: api/Pdfs
  [ResponseType(typeof(Pdf))]
  public async Task&lt;IHttpActionResult&gt; PostPdf(Pdf pdf, double heightInches, double widthInches)
  {
      if (!ModelState.IsValid)
      {
          return BadRequest(ModelState);
      }
  
      // Make a blank PDF based on the dimensions provided
      MemoryStream newBlankPdfMemoryStream = PdfOperations.ITextSharpNewBlankPdf(8.5, 11);
      pdf.Url = await AWS.S3PubliclyAccessibleInsert("paragonpdfimages", pdf.Job_ID + "/" + pdf.Name, newBlankPdfMemoryStream);
  
      db.JobFiles.Add(pdf);
      await db.SaveChangesAsync();
  
      return CreatedAtRoute("DefaultApi", new { id = pdf.ID }, pdf);
  }
  </code></pre>
  
  <p>However, passing this body to the POST route:</p>
  
  <pre><code>{pdf: {Job_Id: 395, Name: "fds"}, widthInches: 8.5, heightInches: 11}
  </code></pre>
  
  <p>Results in a "405 Method Not Allowed" and a message in the body of "The requested resource does not support http method 'POST'".</p>
  
  <p>How can I accomplish this passing of additional parameters to the POST route? Do I need to make a custom route? If so what would that look like? Thanks in advance.</p>