Allowing a client to perform the search and sort operations on a resource collection is very essential to improve the market adoption of your APIs. As there is no existing standard for passing sort criteria or search conditions, various API vendors follow different patterns. A very common approach is to pass the search and sort criteria as the query parameters to the server.
The following example illustrates how you can pass the search criteria as the query parameters to the server:
/employees?departmentName=hr&salary>500000
The query parameters present in the preceding resource request URI can be used by the RESTful API implementation to find out the employee resources belonging to the HR department whose annual salary is greater than 500000.
Similarly, to read the collection of resources in a sorted order, you can pass the sort...