I've wondered this too -- this seems like a common pattern in web apps, but it seems like every API I've come across handles them differently. The one consistency seems to be "q=" for free text search a la Google, but it would be great to see other operations become conventional. I always try to introduce "limit" and "offset" querystring params to my controllers that deal in strait recordsets, but it would be great to have a helper I could call to add filters to my sqlalchemy query object that would translate set, standard methods passed to the controller method. It would be great to be able to drop a like, in, startswith, endswith etc. strait into the querystring -- and it would simplify the design of a lot of APIs.
Of course, this particular DSL may not work well in the querystring pattern -- a lot of operations require a filter/field/value triplet (startswith=name,Dean perhaps? fields won't have commas, right?). Still, if it were simple and standard it could be pretty slick -- otherwise, it'll start looking an awful lot like SPARQL in a url, and that's not really much help to anybody. As for relationships, yeah, from what I can tell two-deep class/id nesting seems to be pretty standard. On Fri, Jun 20, 2008 at 9:11 AM, Alex Marandon <[EMAIL PROTECTED]> wrote: > > 2008/6/20 Sean Davis <[EMAIL PROTECTED]>: > > Therefore, I was planning on a web/web- > > services approach using REST approaches. It seems that dealing with > > single collections is pretty straightforward, but I have a couple of > > questions: > > > > 1) What is the "standard" for filtering a single collection > > (specifying some fields and some match criteria like "begins_with", > > etc.)? > > I guess appending a query string to your resource collection path > would be OK, wouldn't it? > (ie: /authors/12/books?begin_with=foo) I agree that that would be > > > > 2) How does one deal with relationships between collections? It > > looks like nested urls like: > > > > http://example.com/author/12/books > > > > are the correct way to handle this, but could someone enlighten me on > > whether or not there is a standard? > > Routes has support for nested collections: > http://routes.groovie.org/class-routes.base.Mapper.html#resource Look > at the parent_resource argument. > It seems to suggest that the standard would then be /authors/12/books. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
