title: Web API 2: Can a [FromBody] controller method parameter be optional if the controller method is overloaded with both [HttpPost] and [HttpGet]?
body: <p>I sometimes want to Post a Query Object to Web Api 2, but most of the time I just want to use URI parameters to filter data returned by the controller method.  I tried this:</p>
  
  <pre><code>[HttpGet][HttpPost]
  public ResultVM GetResult(
      [FromBody] QueryObjectVM query,
      ,[FromUri] int? custid = null,
      ,[FromUri] int? orderid = null
  )
  </code></pre>
  
  <p>This works great as long as I Post with a Query Object in the body.  I can either include or not include the Uri parameters successfully too.  However, the Query Object fails the Data Binder on a Get because a HttpGet has no body.</p>
  
  <p>I tried to make the query object optional, but this fails on both Get and Post.  Web API data binding does not like the optional null assignment:</p>
  
  <pre><code>[FromBody] QueryObjectVM query = null
  </code></pre>
  
  <p>If the answer is I must have a separate controller method for Post and Get, will Web API 2 handle a HttpGet calling a HttpPost and then return data successfully?  I cannot always call this method using Post calls.</p>