Rest API Design for Order Management System
<p>I am working on a project which is using micro-services architecture.</p>

<p>There is two services:</p>

<ol>
<li>UserAPI : all thing related to user come here.</li>
<li>OMS : All things related to Order Come here.</li>
</ol>

<p>I need to provide orders based on following filter :</p>

<ol>
<li>By User Id</li>
<li>By Date</li>
<li>By Status</li>
<li>By User Phone Number</li>
<li>mix of above</li>
</ol>

<p>So i create an API </p>

<pre><code>path/orders?date=12/11/2016&amp;status=delivered&amp;phone=1111111111
</code></pre>

<p>Now i need to provide Orders for User by user ID. So which is good rest design:</p>

<ol>
<li>Add user ID in query param in existing API like      <code>path/orders?user_id=1</code></li>
<li>Create a Separate API  path <code>user/{user_id}/orders</code></li>
</ol>