Collections and special cases
"risseraka" <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
HELO all,
Let me first say that this mail list, combined with a great amount of blog posts scattered here and there, is a gold mine!
I intend to not only be a digger in the future and be more of the precious metal, if I can.
That being said, I wonder if this goes yet again out of scope of REST as I've read multiple times here that being said about URL design, but well, better ask a possibly dumb question than staying stupid your whole life, I guess.
I've browsed quite a few threads already and used the search engine to no avail, alas.
The study case is where you have a collection of programs and you are trying to get the currently running program out of this collection.
Till now, I have come up with two solutions:
1. /programs?current
2. /programs/live
1. can be understood like applying a sort of filter on the "programs" collection using a "current" query parameter.
2. uses the /entities/{id} schema with a non numerical id, "live".
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.
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.
I hope I'm not making a complete fool out of myself and the entire REST community.
Thanks in advance for your patience!
Adrien.