ChrisR
One of the goals of REST is to surface your state-engine events as
verbs on the underlying nouns.
Yes. I agree, but I think the 'state machine' description is useful.
One of the goals of REST is to surface your state-engine events as
verbs on the underlying nouns.
I agree, but having custom verbs is also not good.
One of the main goals of the REST model is consistancy across models.
I think a lot of this type of state-to-state transition can be covered
with simple updates.
If you need more data than that you may need a has_many through sort
of thing.
As he climbs wearily down from his soap-box, "Oh yeah, it only works
for a single entity life-cycle, so class methods are good for small
batches".
This is definately the case. I think I have the pieces together in my
mind now.
All single model updates (the stuff that would be accessible both
externally and internally) probably ought to be restful.
If you need to do stuff like batch processing you can add extra
options/actions, and it won't break REST.
Thats because when you add these external options for internal use you
are really building a client,
which just happens to reside on the server due to the nature of the
web.
So, go wild but keep it to yourself.
Which, I think is what Jared was suggesting.
As for Nate and Ben.
I think that REST is useful and there is a growing need for machine-to-
machine interaction.
BUT, I think people are misunderstanding what that entails and going
overboard or "bending over backwards" to try and fit round pegs into
square holes.
Lots of discussion, so a summary of my thoughts:
Use/Expose a RESTful interface to each of your models, to handle all
the requests to manipulate single objects.
More complex and batched commands can exist outside the REST model, in
order to provide client-type functionality.
These complex functions need not be exposed (each client should
provide their own utility functions), and for consistancy
they should use the REST methods to actually do the meat of the work
(therefore decoupling/drying up the actual model manipulation from
other complex logic).
Hopefully that makes some sense, I at least feel like I have a much
firmer grasp of what I'm up against.
I think it may take me a bit more time to really put it down in a
succinct, elequent manner...