On 5 Jun 2007, at 06:51, Jim Alateras wrote:
I guess its personal preference but I feel it is more readable,
expressive and consistent using the query string since in most
cases the result set will be constrained by a date range and some
other resource property like 'make'
/cars/registered/2003-03-03/2005-05-50?make=holden
I am not so sure of this.. in particular using /2003-03-03/2005-05-50
as it implies an hierarchy where there is something at /2003-03-03.
If you go for this approach, use "," to separate the two dates as
they are tied together in the range. (or ";", but mr. "RESTful web
services" recommend ";" as separation when the order doesn't matter,
and "," when they do matter. The ISO-8601 standard for a date range
is to use a / as separation, so with that justification using / might
be OK! :-) )
Also, /registered implies kind of that some cars are registered
(hence in /cars/registered) and some are not. If that's true, then
fine, but otherwise it looks a bit weird to me.
/cars?make=holden®isteredDate!From=blah®isteredDate!To=blah
If as Adam suggests you have /car/{make}/{model}/{year}/
you can do /cars/holden?
registered.from=2003-03-03®istered.to=2005-05-30
which makes sense because then /cars/holden will give you all Holden
cars, right? (or at least a range of them)
if you don't care about the make and want anything registered until
today since 2003-03-03:
/cars?registered.from=2003-03-03
(I would prefer using . instead of ! or $ which looks too much perl-
ish to my eyes :-) - although one could argue that dot should rather
be used for subproperties, like ?make.producer.country=USA - I don't
want to think about writing a general support for such, although as a
client it would be really cool! :) )
If you are using from/to as terms, it might be clever to do the range
inclusive on both sides, ie. cars registered 2003-03-03 00:00:00 and
2005-05-30 23:59:61 are both included, while the cars at 2003-03-02
23:59:61 and 2005-05-31 00:00:00 are not, I believe that's what most
people would expect.
(Extreme case here with double leap seconds, I know they wouldn't
happen in May, but still!)
--
Stian Soiland, myGrid team
School of Computer Science
The University of Manchester
http://www.cs.man.ac.uk/~ssoiland/