title: Best Practice for designing a REST API for subsets of a resource
body: <p>Given a URL structure like this:</p>
  
  <pre><code> GET           /user/giftcards/:id
  </code></pre>
  
  <p>When returning list with all my giftcard:</p>
  
  <pre><code> GET           /user/giftcards
  </code></pre>
  
  <p>And here comes my questions, what is best practice for URL structure if I also want to return subsections of the giftcards, like received or sent?</p>
  
  <p>Today I do this (but I know its wrong since the URL should represents the noun / resource (here: giftcard)</p>
  
  <pre><code> GET           /user/giftcardsreceived
   GET           /user/giftcardssent
  </code></pre>
  
  <p>The way I see it there are two "better" solutions:</p>
  
  <pre><code> GET           /user/giftcards/received
   GET           /user/giftcards/sent
  </code></pre>
  
  <p>or</p>
  
  <pre><code> GET           /user/giftcards?filter=received
   GET           /user/giftcards?filter=sent
  </code></pre>
  
  <p>Im leaning towards the request param solution with filtering since the other solution could potentially conflict with the GET based on id. </p>
  
  <p>Any pointing in right direction appreciated.</p>