title: REST API Best Practices for Hierarchical JSON Objects
body: <p>Imagine a simple example like 'Vehicle Make and Model' REST API with CRUD methods implemented.</p>
  <p>The relation between Vehicle Make to Model is 1:N. One vehicle make can have N models in it, but, one model is assosiated with just one make.</p>
  <p>Our CRUD methods:</p>
  <ul>
  <li>POST/PUT vehicles/makes: To create or update basic info about one vehicle make.</li>
  <li>GET vehicles/makes: To get a list of vehicle makes.</li>
  <li>GET vehicles/makes/{id}: To get a specific vehicle make with their info.</li>
  <li>POST/PUT vehicles/makes/{id}/models: To create or update basic info about one vehicle model.</li>
  <li>GET vehicles/makes/{id}/models: To get a list of vehicle models of a specific make.</li>
  <li>GET vehicles/makes/{id}/models/{id}: To get a specific vehicle model of a specific make.</li>
  </ul>
  <p><strong>The question is:</strong></p>
  <p>Should the <code>GET makes or makes/{id}</code> return in it a list of theirs models? Or maybe, should the models be returned only in a specific request?</p>
  <p>What must I consider to return or not a nested info in my API?</p>
  <hr />
  <p>The example is a quite simple, but the scenario can be expanded in a way with a lot of hierarchical dependencies, like:</p>
  <pre>
  vehicle
  ├── vehicle_make
  │   ├── vehicle_model
  │   └── ...
  ├── tires
  │   └── tire_brand
  │       ├── tire_model
  │       └── ...
  └── ...
  └── ...
  </pre>