I would like to implement a REST service which is able to parse query such as retrieving the users created after startdate and before endate and with the privilege of admin. It seems that standard REST implementation could only query by ID. Do I need to self-defined protocol to make this kind of query possible or any standard?
Thanks!
There is no constraint in REST that says you can only query by ID. There is absolutely nothing wrong with using a set of query parameters to return a set of users that match those search criteria.
Take a look at Google's GDATA Protocol. It's very RESTful and they have a very nice way of performing "complex" queries while still keeping a clean URI.
http://code.google.com/apis/gdata/docs/2.0/reference.html#Queries
Here is an example of what their clean query URIs
http://example.com/jo/-/Fritz/2006
instead of
http://example.com/jo?category=Fritz&category=2006
From Google:
This approach identifies a resource without using query parameters, and it produces cleaner URIs. We chose this approach for categories because we think that category queries will be the most common queries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With