Re: the meaning of stateless
Mike Schinkel <[email protected]>
| Newsgroups | gmane.comp.web.services.rest |
|---|---|
| Message-ID | <[email protected]> |
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. So I'm hoping you can break the mental logjam for me. -Mike