title: API Post - Pass entire object or just reference id
body: <p>If I have an API with an endpoint POST /product. This endpoint has some properties, one of them is category. Assuming that I'm using nosql database, what should I do?</p>
  <ol>
  <li><p>Send entire category like</p>
  <p><code>{ &quot;id&quot;: 1, &quot;name&quot;: &quot;Product&quot;, &quot;category&quot;: { &quot;id&quot;: 1, &quot;name&quot;: &quot;Category&quot; } }</code></p>
  </li>
  <li><p>Send just the id and use it to get the category from database, then generate my product document</p>
  <p>Request body</p>
  <p><code>{ &quot;id&quot;: 1, &quot;name&quot;: &quot;Product&quot;, &quot;category&quot;: 1 }</code></p>
  <p>Document to save in db</p>
  <p><code>{ &quot;id&quot;: 1, &quot;name&quot;: &quot;Product&quot;, &quot;category&quot;: { &quot;id&quot;: 1, &quot;name&quot;: &quot;Category&quot; } }</code></p>
  </li>
  </ol>