Xavier N. wrote:
messages/recent/30
with 30 being some sort of period parameter?
Yeah, looks clean to me.
Clean, yes. RESTful, not so much.
You pose a good question, monkeyten, and I’m afraid I don’t have an
answer. I never really caught on with REST. It looks sweet, and I dig
the ideals, but it’s so hard to implement. Your situation is just one of
many “edge cases.” Others I’ve run into are…
A query from the same table for objects of varying statuses. Say I want
a list of all purchase order objects whose status is completed. Per my
understanding of REST, I should probably have something like…
completed_purchase_orders/index
And for pending purchase orders…
pending_purchase_orders/index
In the OP’s situation, again per my understanding, I’d say you have a
resource called recent_messages…
recent_messages/index
In fact, I’m not so sure about the index method at all – can someone
with more experience in REST throw some knowledge on me? Here’s how I
currently see it…
You’ve got four methods (verbs) at your disposal for acting on a
collection of resources. Post, get, put and delete. Create, show, update
and destroy.
Now, where in that list is index? I don’t see it. Why are we using it?
If I want to access a list of all my users, shouldn’t it be…
user_list/show
And not…
users/index
In the past month or so I’ve become really interested in REST. Primarily
because of the write-ups over at Pivotal Blabs detailing a controller
formula, RESTful authentication and CUDly models. So, I’d LOVE to start
using it full-throttle with no exceptions, but sometimes it feels so
contrived…