Re: Collections and special cases

"risseraka" <[email protected]>
Newsgroups gmane.comp.web.services.rest
Message-ID <[email protected]>
--- In [email protected], Jan Algermissen  wrote:
>
> 
> On 14.01.2013, at 11:10, "risseraka"  wrote:
> > Whereas my personal preference goes for the first solution, my guts get a bit fuzzy with trying to get a single item hitting directly on the collection end-point.
> 
> Agreed - your scenario is 'indexing' into the collection not a 'sub bucket'. You could, of course, argue about this a lot - here are two things to consider:
> 
> - do you maybe have more filters that work in parallel? This makes the first solution obviously better.

I'm not sure if you mean parallel as in "mutualy exclusive" or as in "combinative".

There is a case where a program is looked up by a timestamp with an "at" parameter.
If "current" and "at" parameters are used together, "current" will take precedence over "at" and redirect accordingly to the current program.

I have pondered on solutions like /programs?at=1359000000 and /programs?at=now but am not convinced.

> - Implementation-wise the first solution is usually cleaner, because {id} will always denote an ID in your code, no special if(id == "live") needed.

Indeed, if(id == "live") is a pain whereas if(query.current) is much smoother.

> > 
> > In both cases a 302 Moved Temporarily is performed(?) to redirect to the live program's URI, /programs/1234 with "1234" being the current program's id.
> 
> Yes, makes sense.
> 
> 
> Jan

Adrien.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.