REST/ROA Architecture - Send database search/querying/filter/sorting parameters in URL? (>, <, IN, e
- by DutrowLLC
I'm building a REST interface to my application using ROA (Resource Oriented Architecture) .
I'd like to give the client the ability to specify search parameters in URL. So a client could say "Give me all people who's:
"first_name" is equal to "BOB"
"age" is greater than "30"
sort by "last_name"
I was thinking something like:
GET /PEOPLE/{query_parameters}/{sort_parameters}
...or perhaps
GET /PEOPLE?query=<query_string>&sort=<sort_string>
...but I'm unsure what syntax would be good for specifying in the COLUMN_NAME-OPERATOR-VALUE triplicates. I was thinking perhaps something like:
column_name.operator.value
So the client could say:
GET /PEOPLE?query=first_name.EQUALS.bob&query=age.GREATER_THAN.30&sort=last_name.ASCENDING
I really don't want to re-invent the wheel here, are there some accepted ways that this is done? I am using Restlets, I don't know if that makes a difference.