title: How to return generated ID in RESTful POST?
body: <p>Let's say we have a service to add a new hotel:</p>
  
  <pre><code>&gt; POST /hotel
  &gt; &lt;hotel&gt;
  &gt;   &lt;a&gt;aaa&lt;/a&gt;
  &gt;   &lt;b&gt;aaa&lt;/b&gt;
  &gt;   &lt;c&gt;aaa.......this is 300K&lt;/c&gt;
  &gt; &lt;/hotel&gt;
  </code></pre>
  
  <p>And then we have a get:</p>
  
  <pre><code>&gt; GET /hotel
  
  &lt; HTTP/1.1 200 OK
  &lt; &lt;hotel&gt;
  &lt;   &lt;a&gt;aaa&lt;/a&gt;
  &lt;   &lt;b&gt;aaa&lt;/b&gt;
  &gt;   &lt;c&gt;aaa.......this is 300K&lt;/c&gt;
  &lt; &lt;/hotel&gt;
  </code></pre>
  
  <p>Question is what do we return for the initial POST creation?  We would like to return the ID (generated on the server) for a "reference" to the new resource but we don't want to return all the hotel data as in our case one of the data fields is a flat file of ~300K.</p>
  
  <p>So should you just return:</p>
  
  <pre><code>&lt; HTTP/1.1 200 OK
  &lt; &lt;hotel&gt;
  &lt;   &lt;id&gt;123&lt;/id&gt;
  &lt; &lt;/hotel&gt;
  </code></pre>
  
  <p>Or should you return the full object:</p>
  
  <pre><code>&lt; HTTP/1.1 200 OK
  &lt; &lt;hotel&gt;
  &lt;   &lt;id&gt;123&lt;/id&gt;
  &lt;   &lt;a&gt;aaa&lt;/a&gt;
  &lt;   &lt;b&gt;aaa&lt;/b&gt;
  &gt;   &lt;c&gt;aaa.......this is 300K&lt;/c&gt;
  &lt; &lt;/hotel&gt;
  </code></pre>
  
  <p>??</p>
  
  <p>I'm interested in the restful best practice.  </p>
  
  <p>Note: this related <a href="https://stackoverflow.com/questions/797834/should-a-restful-put-operation-return-something">post</a> talks more about what to return but less about how to return it.</p>