3 ms·
For the deposit/withdrawal/transfer set, depending on the specifics of how they are actually moving the amounts around, would likely be best served as their own
by qyv 10y ago
For the deposit/withdrawal/transfer set, depending on the specifics of how they are actually moving the amounts around, would likely be best served as their own resource. Since a deposit/withdrawal is just a transfer anyways, just having "/transfer" would be likely be good. The connotation here is that the client is creating a transfer on the server. The body for this request could take the relevant account numbers (you need two accounts), and the sign on the amount would denote if the amount is being deposited or withdrawn.
- blowski 10y agoSo I would make a request like: POST /transfer from_account_id=12345&to_account_id=67890&amount=10 Perhaps I've misunderstood your comment, as I don't really understand why this is better than the original: POST /accounts/12345/transfer to_account_id=67890&amount=10 or even: POST /accounts/12345/withdraw amount=10
- qyv 10y agoHaving the /account/:accountid/transfer is not a terrible idea, but I would avoid it because the transfer resource is able to stand on it's own with making it tied to a single account resource. The key point though is that 'transfer' is the resource to perform all three of the original deposit/withdrawal/transfer actions.