title: Best Practices for multiple POST calls in Web Api on the same controller
body: <p>I have a question for you guys that do Web API REST services. How do you design your services to handle a POST of a single entity, as well as being able to receive a POST of a collection of said entity?</p>
  
  <p>For example:</p>
  
  <pre><code>public IHttpActionResult Post([FromBody]User value)
  {
      // stuff
  }
  
  public IHttpActionResult Post([FromBody]IEnumerable&lt;User&gt; values)
  {
      // stuff
  }
  </code></pre>
  
  <p>Out of the box, this does not work because the default route matches both of these. </p>
  
  <p>I know there are several different ways that I can tackle this, but I'm wanting to learn the "best practice" way.</p>
  
  <p>What do you do to accomplish this same behavior?</p>
  
  <p>My thoughts are as follows:</p>
  
  <ol>
  <li>I could make it so the signature of the post just takes a List as a parameter.  I'd be doing away with the one that just takes a single User.  Any code using that api call would just have to know to wrap its entity in a collection of some kind.</li>
  <li>I can create two different controllers, api/user and api/users each having their own POST.  This approach doesn't really jive with REST, since api/user retrieves all users, and api/user/1 retrieves user with Id == 1, so what would api/users mean?  What would api/users/1 mean?  etc... so probably not this option.</li>
  <li>Try to get this to work with some set of custom constraints combined with ActionName attributes in the controller, with routes written up for each POST (I am not certain if this one will work at all).</li>
  <li>Make it an RPC call.  If this is the case, what do you name your RPC controllers?  Where do you locate them in the solution when some are REST and some are RPC?  What criteria should I use to determine if an RPC call is required or if I should leave it as REST?</li>
  <li>Something else entirely?</li>
  </ol>
  
  <p>Thank you for your words of wisdom.  I really appreciate any/all participation in this.  I'm really just trying to get a grasp on what the best practice is.  Any examples that can be given would also be super!</p>