title: Should nested relationships be reflected in URLs for JSON API?
body: <p>I'm trying to follow <a href="http://jsonapi.org/" rel="noreferrer">JSON API</a>. I need to expose CRUD access to a nested resource: product reviews.</p>
  <p>Prior to using JSON API, I'd expect a REST interface like this:</p>
  <pre><code>GET    /products/:product_id/reviews     - list reviews for a product
  POST   /products/:product_id/reviews     - add a review for a product
  PATCH  /products/:product_id/reviews/:id - update a review for a product
  DELETE /products/:product_id/reviews/:id - delete a review for a product
  </code></pre>
  <p>I see some mention of a nested structure like this <a href="http://jsonapi.org/recommendations/#urls-relationships" rel="noreferrer">in the spec</a>:</p>
  <blockquote>
  <p>For example, the URL for a photo’s comments will be:</p>
  <p><code>/photos/1/comments</code></p>
  </blockquote>
  <p>But I'm not sure whether this structure is intended for all actions.</p>
  <p>On the one hand, <code>POST /products/:product_id/reviews</code> for creation seems redundant if I'm going to specify the product in the POST body, under the review data's <code>relationships</code>.</p>
  <p>On the other hand, if it's useful to specify a product id when deleting a review (maybe it isn't), <code>DELETE /products/:product_id/reviews/:id</code> seems like the only sane way to do it; <a href="https://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request">people argue about whether a request body is even allowed for DELETE requests</a>.</p>
  <p>I could nest for some requests and not others:</p>
  <pre><code>GET    /products/:product_id/reviews  - list reviews for a product
  POST   /products/:product_id/reviews  - add a review for a product
  PATCH  /reviews/:id                   - update a review
  DELETE /reviews/:id                   - delete a review
  </code></pre>
  <p>But that seems weirdly inconsistent.</p>
  <p>I could never nest:</p>
  <pre><code>GET    /reviews     - list reviews for the product specified in params
  POST   /reviews     - add a review for the product specified in params
  PATCH  /reviews/:id - update a review
  DELETE /reviews/:id - delete a review
  </code></pre>
  <p>But that seems awkward, and doesn't seem to match the first quote I made from the docs.</p>
  <p><strong>Should nested resource relationships be reflected in the URL when using JSON API?</strong></p>