You can find whole articles theorizing when you should use what METHOD
in what edge case.
It mostly comes down to this; every action needs to be simplified to in just four flavours (GET, POST, PUT, DELETE) - and this is often insufficient to be expressive.
Especially if you look at domain driven design, this is unfit. I would argue that every developer that tries to shoehorn all his code into just these methods (in their Java code) will have some bad time during code reviews. You clearly need to have documentation to be really sure what is going on.
/employees/active/john-doe (DELETE)
Does DELETE mean DELETING the resource, or DELETE (remove) it from the 'active' list?
/employees/active/john-doe/remove-from-active
would be a lot more expressive. Everyone using this method will be confident that we are not accidently deleting this employee. POST, GET, who cares - as long as we are authorized.
Some people will probably theorize that the first url is anyway not expressive - but then what would the DELETE
method really add? If the URL on itself is expressive - isn't the DELETE
method duplicate information (not DRY)?
Is there anything wrong with being pragmatic and always use POST?
For some time I'm actually just using POST methods for all my Ajax calls. Except some caching issues I don't see any problems.
While I would be in favour of dropping Method at all, I think there is actually a more clear distinction between GET
and POST
, because GET expresses no side effects.
Am I missing something or are we (as internet community) embracing legacy design just because it is already there and we are stuck with it?
Are there any good arguments that Http Method
is a 'good design', besides that we should stick to conventions that are already there?