Let's consider I need to develop a REST bank application that allows the creation/destruction of bank accounts as well as the following operations on an account: withdraw/credit/getBalance.
- Creation of an account
PUT /Bank/john
Here I use PUT instead of POST because this operation is idempotent and because the client is giving the URL
- Destruction of an account
DELETE /Bank/john
- GetBalance
GET /Bank/john
- Withdraw money from an account
POST /Bank/john
action=withdraw&value=10
- Credit money to an account
POST /Bank/john
action=credit&value=10
Here, I used POST because withdrawal/credit are clearly not idempotent
is it a RESTful compliant way of designing these operations ?
I have the feeling that I am writing something that is RPC-like by putting the verbs (withdraw | credit) inside the action parameter .. and I often read that REST should not mimic the RPC-like style ...