title: 'Best' practice for restful POST response
body: <p>So nothing new here I am just trying to get some clarification and cannot seem to find any in other posts.</p>
  
  <p>I am creating a new resource restulfully, say:</p>
  
  <pre><code>/books (POST)
  </code></pre>
  
  <p>with a body:</p>
  
  <pre><code>{
    title: 'The Lion, the Witch and the Wardrobe',
    author: 'C. S. Lewis'
  }
  </code></pre>
  
  <p>I know that I should return a 201 (Created) with a Location header of the new resource:</p>
  
  <pre><code>Location: /books/12345
  </code></pre>
  
  <p>The question I cannot seem to answer for myself is what should the server return in the body.</p>
  
  <p>I have often done this type of response:</p>
  
  <pre><code>{
    id: 12345,
    title: 'The Lion, the Witch and the Wardrobe',
    author: 'C. S. Lewis'
  }
  </code></pre>
  
  <p>I have done this for a couple reasons:</p>
  
  <ol>
  <li>I have written api for front end frameworks like angularjs.  In my
  particular case I am using angular resources and I often need just
  the id for the resource to locate it.  If I did not return the id in
  the response body I would need to parse it out of the Location
  header.</li>
  <li>In a GET of all books I usually return the entire object not just
  the id.  In this sense my client code does not have to differentiate
  where to get the id from (location header or body).</li>
  </ol>
  
  <p>Now I know I am really in the grey area here, but most people are saying that returning the entire resource is 'bad' practice.  But what if the server changes/adds information to the resource.  It definitely adds the id, but might also add other things like a timestamp.  In the case that I do not return the entire resource, is it really better to do a POST, return the id, then have the client perform a GET to get the new resource.</p>