I have been using SubSonic as a data access layer for a couple of years now to take the mundane work out of writing and updating SQL. SubSonic also offers a simple, but powerful REST interface for exposing data to the world for consumption by Ajax and other web technologies. Recently, I couldn't find a complete list of prefix/suffix operators for querying against a REST data set, so I dug into the SubSonic source code and found these. Below is an example REST url; with a list of prefix/suffixes that can be used to query your data:
Ex 1 - Lists all the records in our Directory table
http://whit-webman.ad.syr.edu/REST/directory/list.xml
Ex 2 - ID's that are greater than 100 (using prefix/suffixes)
http://whit-webman.ad.syr.edu/REST/directory/list.xml?min_facultyid=100
Ex 3 - Filter by Last Name (straight-up field query)
http://whit-webman.ad.syr.edu/REST/directory/list.xml?lastname=daley
Now, here is the list of prefix/suffix parameters for your REST url query.
min_: > (greater than)
minz_: >= (greater than or equal to)
max_: < (less than)
maxz_: <= (less than or equal to)
_not: Is Not
_notequal: Not Equals
_is: Is
_like: LIKE
_notlike: NOT LIKE
Hopefully you can see the power in this. Just as a note, you don't have to use xml as a return type, you can also use JSON or RSS if your web server is configured for it.
1 comment:
Nice work meng
Post a Comment