title: "Right" REST URL to get all resources within all resources?
body: <p>So... I am aware that this question could be dangerously close to being <em>opinion based</em> . I'm hoping is not, and that the REST standard is clear about what I'm going to ask but if it's not, I'll close it.</p>
  
  <p>I have a website (in Django, with the data being stored in Postgres) with <code>Product</code>(-s) and <code>Category</code>(-ies) Each <code>category</code> can contain several <code>product</code>(-s).</p>
  
  <p>So, the question is: What would be the "right" endpoint (if there's any) to GET all the categories with all the products in each?</p>
  
  <p>I believe it would be clear getting all the products of a specific category. For instance, if the category ID was <code>24</code>, in order to get all its products, I would write:</p>
  
  <p><code>http://myserver.com/api/categories/24/products
  </code></p>
  
  <p>But how about ALL the categories with ALL the products in each?</p>
  
  <p>Would it be <code>http://myserver.com/api/categories/products</code>? </p>
  
  <p>Would it be <code>http://myserver.com/api/categories/all/products</code>? </p>
  
  <p>Would it be better using some kind of parameter, such as <code>http://myserver.com/api/categories?mode=all_products</code> ?</p>
  
  <p>The idea would be having a response like this (JSON format)</p>
  
  <pre><code>{
      "25": [{
          "id": 1,
          "name": "Product 1 in category 25",
          "price": 100
      }, {
          "id": 2,
          "name": "Product 2 in category 25",
          "price": 200
      }],
      "26": [{
          "id": 3,
          "name": "Product 1 in category 26",
          "price": 300
      }, {
          "id": 4,
          "name": "Product 2 in category 26",
          "price": 400
      }]
  }
  </code></pre>
  
  <p>Thank you in advance.</p>