title: When to use @QueryParam vs @PathParam
body: <p>I am not asking the question that is already asked here:
  <a href="https://stackoverflow.com/questions/5579744/what-is-the-difference-between-pathparam-and-queryparam">What is the difference between @PathParam and @QueryParam</a></p>
  
  <p>This is a "best practices" or convention question.</p>
  
  <p>When would you use <code>@PathParam</code> vs <code>@QueryParam</code>.</p>
  
  <p>What I can think of that the decision might be using the two to differentiate the information pattern. Let me illustrate below my LTPO - less than perfect observation.</p>
  
  <p>PathParam use could be reserved for information category, which would fall nicely into a branch of an information tree. PathParam could be used to drill down to entity class hierarchy.</p>
  
  <p>Whereas, QueryParam could be reserved for specifying attributes to locate the instance of a class.</p>
  
  <p>For example,</p>
  
  <ul>
  <li><code>/Vehicle/Car?registration=123</code></li>
  <li><code>/House/Colonial?region=newengland</code></li>
  </ul>
  
  <p><code>/category?instance</code></p>
  
  <pre><code>@GET
  @Path("/employee/{dept}")
  Patient getEmployee(@PathParam("dept")Long dept, @QueryParam("id")Long id) ;
  </code></pre>
  
  <p>vs <code>/category/instance</code></p>
  
  <pre><code>@GET
  @Path("/employee/{dept}/{id}")
  Patient getEmployee(@PathParam("dept")Long dept, @PathParam("id")Long id) ;
  </code></pre>
  
  <p>vs <code>?category+instance</code></p>
  
  <pre><code>@GET
  @Path("/employee")
  Patient getEmployee(@QueryParam("dept")Long dept, @QueryParam("id")Long id) ;
  </code></pre>
  
  <p>I don't think there is a standard convention of doing it. Is there? However, I would like to hear of how people use PathParam vs QueryParam to differentiate their information like I exemplified above. I would also love to hear the reason behind the practice.</p>