I use basically the first form.

What's with the $ and ! in there?? I just name my variables what they are, generally using common java naming conventions, or hyphen/underscore if need be.

?registeredDateFrom=2003-03-03&registeredDateTo=2005-05-05

When you're specifying ranges like this, you're going to have one less-than and one greater-than comparator ultimately in your SQL statement (or a BETWEEN statement). Therefore, you usually don't allow users to specify the equality operator since you've pretty much defined what the range is going to be.

If you do need to encode an equality operator, I would suggest using "eq", "ne", "lt", "lte", "gt", "gte" which are common abbreviations.

Remember the REST form. Generally, query string parameters should be for "optional" data. If the "from" and "to" fields are required fields (the user can't make a query without these specified), then you could (should even) use the form:

/cars/2003-03-03/2005-05-05/

Ie. no query string, but actual "parameters" in the uri. This is a slightly better form (though obviously not different functionally).

My point is, what is the /cars URL (without the query string) going to return to the user?? It should be defined to return some list and the query string parameters will modify the default criteria for said list.

I would tend to favor international format for dates, like the above YYYY-MM-DD format. Obviously specifying MM-YYYY is acceptable internationally, but DD-MM-YYYY is ambiguous with MM-DD-YYYY here in the USA.

Adam


Jim Alateras wrote:
I am interested in hearing how people use the query string to
constrain a GET.

For instance if i want to get a list of cars registered between
03/2000 and 09/2006

/cars?registeredDate$from=03-2000&registeredDate$to=09-2006
/cars?registeredDate!from=03-2000&registeredDate!to=09-2006
/cars?registeredDate=[03-2000,06-2006]

How are people encoding expressions such as >, >=, < and <= within a
GET request.


cheers
</jima>

Posted something similar to the yahoo rest group but also wanted to get some feedback from this group


Reply via email to