I think so, yeah.
http://example.com/resources/ (collection) |
|---|
http://example.com/resources/item17 (item) |
|---|
That show, um, rocks! heh. :)
It's a two-line tweak, and then the URIs can look like this:
/{entity}/?{entityId}?/?
Of course, this begs the question of sub-entities (for lack of a better
term ATM), and when this approach is actually optimal. Ex:
#Entity.cfc (?)
/{entity}/?{entityId}?/?{subentity}?/?{subentityId}?/?
VERSUS:
#Person.cfc
/person/?{personId}?/?
#PersonAddress.cfc
/person/{personId}/address/?{addressId}?/?
To me it seems to depend a *lot* on what you are doing. Do you already
have an API that you're just wrapping with RESTfulness? Are you maybe
making a dead-simple RESTCRUD type of deal for ORM entities? ;)p
Bleh. Besides the gory examples, it *can* be optimal, as look at what
you'd have to do as it stands:
#People.cfc
/person/?
#Person.cfc
/person/{personId}/?
#PersonAddresses
/person/{personId}/address/?
#PersonAddress
/person/address/{addressId}
(or some such) Even if you've got things encapsulated to where a single
Person.cfc gets the "person" job done (same for address). (Don't get me
started on if the end slash should be meaningful or not.)
Eh. People vs. person probably isn't as big a deal as post vs. put:
http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-rest-of-the-story/
(that was an article that made an impression on me when I started RESTing)
But I digress... =]
:den
--
As we realize that more and more things have global impact, I think
we're going to get people increasingly wanting to get away from a purely
national interest.
Peter Singer
LOL! CAreharted, yo! :)
Yeah, I focused a lot on plural(s) but I guess what I was thinking of is
if you've got a student service, which handles the many and the one, and
you just want a StudentRESTService vs. a StudentRESTService and
StudentRESTServiceCollection type of deal.
It all depends on what yer doing, what you've got to work with, etc., I
think.
> Aside from that, it sounds like a philosophical disagreement, which is,
> nearly by definition, unresolvable. ;)
Maybe... an agnostic, logically, has a better chance than an [a]theist,
if we were to posit the proof/negation of God or an afterlife or some
such, neh? Better odds covering both than taking a side... ;))
*evil grin*
:Denny
--
Bush doesn't present himself as a realpolitik politician.
Peter Singer