6 ms·
The RESTful way to do that would be something like: POST /transactions from: /accounts/savings to: /accounts/chequing amount: 123.45 Genera
by bct 18y ago
The RESTful way to do that would be something like:
POST /transactions
from: /accounts/savings
to: /accounts/chequing
amount: 123.45
Generally the proper way to do something atomically is to do it in a single request.
REST isn't the best choice for every application - the whole point is that it has certain strengths - but it's very flexible.
- ajross 18y agoNo, no, no. That's not RESTful at all. What "thing" does /transactions represent? It's the same URI for every single account in the world? What you've done is break out of the paradigm in order to solve a particular problem, which is great. But don't call it "REST", because the whole point of this discussion is that doing so confuses people about what REST is supposed to mean.
- bct 18y agoIt's a collection of transactions. What's unRESTful about that? Collections of things are a very common REST pattern. Naturally you would also want a URI for each account, and it might make sense to have many different collections of transactions. I don't see how that breaks out of the paradigm. Edit: I'm using "transactions" as in "financial transactions" (as opposed to "database transactions")