I am not asking the question that is already asked here:
What is the difference between @PathParam and @QueryParam
This is a "best practices" or convention question.
When would you use
Patient getEmployee(@PathParam("dept")Long dept, @QueryParam("id")Long id) ;
Patient getEmployee(@PathParam("dept")Long dept, @PathParam("id")Long id) ;
Patient getEmployee(@QueryParam("dept")Long dept, @QueryParam("id")Long id) ;
REST may not be a standard as such, but reading up on general REST documentation and blog posts should give you some guidelines for a good way to structure API URLs. Most rest APIs tend to only have resource names and resource IDs in the path. Such as:
Some REST APIs use query strings for filtering, pagination and sorting, but Since REST isn't a strict standard I'd recommend checking some REST APIs out there such as github and stackoverflow and see what could work well for your use case.
I'd recommend putting any required parameters in the path, and any optional parameters should certainly be query string parameters. Putting optional parameters in the URL will end up getting really messy when trying to write URL handlers that match different combinations.