Re: the meaning of stateless

Mark Baker <[email protected]>
Newsgroups gmane.comp.web.services.rest
Message-ID <CALcoZioVK2L1AZPiBGFgzK_7ZO8uDcMsS4mdZg673-Qzxxzvdw@mail.gmail.com>
Hi Mike,

On Wed, Apr 24, 2013 at 5:25 PM, Mike Schinkel <[email protected]> wrote:
> Hi Mark,
>
> I'm really struggling to get the nuances with this, hoping you can help.
>
> On Apr 24, 2013, at 2:23 PM, Mark Baker <[email protected]> wrote:
>
> It is, but the *meaning* of future messages doesn't change if the
> state of that resource changes.
>
>
> If that is absolutely true, then how can REST implement workflow or
> transactions? For example (admittedly trivial, but the pattern could be
> applied to something much less than trivial):
>
> GET /client/abc123/accounts
> ---> 200 ok, [ { "account": "checking", "balance": 500.00 },{ "account":
> "savings", "balance": 100.00 }]
>
> POST /client/abc123/account-transfer/new
> ---> 200 ok, Location: /account-transfer/12345
>
> PUT /client/abc123/account-transfer/12345/checking
> balance=350
> ---> 200 ok
>
> PUT /client/abc123/account-transfer/12345/savings
> balance=250
> ---> 200 ok
>
> POST /client/abc123/account-transfer/12345
> action=commit
> ---> 200 ok
>
>
> In the real world I can come up with all kind of other examples where an
> action based on a POST would be different based on POSTs and PUTs that came
> before it, or the thing that needs to be accomplished cannot be. So my
> intuition tells me that there must be some kind of state that is okay and
> some kind of state that is bad but the more questions I ask the less I'm
> confident that I understand the answer. Based on your comment I would be
> driven to think that systems cannot implement workflow or transactions and
> still be RESTful.

Well, it sounds like you have a far narrower view than I do of what
constitutes "workflow" or "transactions", but yah, what you've got
above is totally stateful.

Mark.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.