On Mon, Feb 22, 2010 at 6:59 PM, David Zülke <[email protected]> wrote: > On 22.02.2010, at 10:08, Simon Cornelius P Umacob wrote: > >> On Mon, Feb 22, 2010 at 5:02 PM, David Zülke >> <[email protected]> wrote: >>> >>> GET /products - list >>> GET /products?num=100&page=2 - this is how you use query strings >>> properly, >>> /products/100/2 or so would *not* be RESTful as it doesn't represent a >>> resource >> >> Yikes, I didn't know that. In order to make this RESTful, do we need >> to use /products/num/100/page/2 instead? What's the general rule for >> creating "beautiful" RESTful URLs? =) > > No... I'm saying that it is wrong in any case. The purpose of the query > string is to provide filtering, sorting, "querying" options for a resource. > > "/products/num/100/page/2" is *not* a resource. It is a specific > representation of a subset of the resource "/products", and thus should > *not* have a different URL. So "/products?num=100&page=2" is *correct*. > > Same for search URLs. It's "/search?q=blah&type=image", not > "/search/blah/image" or something else. Such a URL structure also doesn't > scale well because you'll keep adding filtering options to the URL which > causes ambiguities etc. Don't do it. >
I think I've learned something new today. I've been using REST incorrectly because I went gung ho with Agavi's routing feature... =) [ simon.cpu ] _______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
