title: REST - put IDs in body or not?
body: <p>Let's say I want to have a RESTful resource for people, where the client is able to assign ID.</p>
  
  <p>A person looks like this: <code>{"id": &lt;UUID&gt;, "name": "Jimmy"}</code></p>
  
  <p>Now, how should the client save (or "PUT") it?</p>
  
  <ol>
  <li><code>PUT /person/UUID {"id": &lt;UUID&gt;, "name": "Jimmy"}</code> - now we have this nasty duplication that we have to verify all the time: Does the ID in body match the one in path?</li>
  <li>Asymmetric representation:
  
  <ul>
  <li><code>PUT /person/UUID {"name": "Jimmy"}</code></li>
  <li><code>GET /person/UUID</code> returns <code>{"id": &lt;UUID&gt;, "name": "Jimmy"}</code></li>
  </ul></li>
  <li>No IDs in body - ID only in location:
  
  <ul>
  <li><code>PUT /person/UUID {"name": "Jimmy"}</code></li>
  <li><code>GET /person/UUID</code> returns <code>{"name": "Jimmy"}</code></li>
  </ul></li>
  <li>No kind of <code>POST</code> seems like a good idea since the ID is generated by the client.</li>
  </ol>
  
  <p>What are the common patterns and ways to solve it? IDs only in location seems like the most dogmatically correct way, but it also makes the practical implementation harder.</p>