On Feb 8, 5:43 am, “monki” [email protected] wrote:
That sounds entirely logical to me.
REST uses nouns, not verbs. So having other actions than CRUD (which
can use the same noun, at least in theory, by using HTML PUT, GET,
DELETE) is against the RESTful rules.
Just a point of clarification of the concept of REST (at least the one
that is inside my head).
REST .NEQ. CRUD
REST uses verbs acting on nouns.
Simple entities with trivial life-cycles can be handled with CRUD.
They are either there or they are not. In business analysis terms,
these are usually classifiers or look-ups (e.g. sales area, message
type,…)
More interesting entities have a richer life-cycle typically marked
with a status field.
(e.g. Mail message={Unread,Read,Archived}, WorksOrder =
{Booked,Scheduled,In Progress, Completed,Billed} )
Now moving from one status to another is a life-cycle event and often
there is extra data involved.
So the ‘Read’ event for the mail-message moves it from ‘Unread’ to
‘Read’ and may involve populating the read_date column.
The ‘StartWork’ event for the WorksOrder moves it from the
‘Scheduled’ to ‘In progress’ state and may involve populating the
start_date and also adding work-queue information to other parts of
the data model.
This concept is very well documented in its variants as ‘finite state
machine’, ‘state transition diagram’,‘state machine’,‘state
engine’,‘life-cycle model’,…
One of the goals of REST is to surface your state-engine events as
verbs on the underlying nouns.
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”.