title: REST api request method input parameters
body: <p>i've been researching/creating a REST api, in the backbone.js to php context.</p>
  
  <p>i understand the concept of HTTP verbs and when they should be used</p>
  
  <p><code>GET - select</code></p>
  
  <p><code>POST - create</code></p>
  
  <p><code>PUT - update</code></p>
  
  <p><code>DELETE - delete</code></p>
  
  <p>i also understand the concept of passing an identifier as a semantic url, e.g.</p>
  
  <p><code>GET http://api/users/123</code></p>
  
  <p><code>DELETE http://api/users/123</code></p>
  
  <p>in these cases the "123" is the id the business logic will use to get/delete a user.</p>
  
  <p>but what about the POST and PUT contexts? when sending a request to </p>
  
  <p><code>PUT http://api/users/123</code></p>
  
  <p>the api will update user id 123 with the supplied parameters, here's where my question arises. </p>
  
  <p>i would assume the input parameters to update with would be sent as PUT parameters. in php syntax this is represented as: <code>file_get_contents('php://input')</code> (this is the same for delete requests.)</p>
  
  <p>when testing this via backbone.js it works perfectly.</p>
  
  <p>but when i try and create a new element with</p>
  
  <p><code>POST http://api/users/</code></p>
  
  <p>i would assume the input values would sent as POST parameters/ in php syntax this is represented as <code>$_POST</code>. but this does not work. </p>
  
  <p>after some testing, and reading up on rails style REST apis (which is what the backbone docs suggest), i realized that <strong>all</strong> request variables are sent the same way. if i change my code to use <code>file_get_contents('php://input')</code> to get the request parameters for every request type,  backbone works perfectly.</p>
  
  <p>is this standard fair for REST apis? or just "rails flavored" ones?</p>