java - Use POST for delete/update in Rest? -


i understand (from accepted answer what difference between http , rest?) rest set of rules how use http

accepted answer says

no, rest way http should used.

today use tiny bit of http protocol's methods – namely , post. rest way use of protocol's methods.

for example, rest dictates usage of delete erase document (be file, state, etc.) behind uri, whereas, http, misuse or post query ...product/?delete_id=22

my question disadvantage/drawback(technical or design) if continue use post method instead of delete/put deleting/updating resource in rest ?

my question disadvantage/drawback(technical or design) if continue use post method instead of delete/put deleting/updating resource in rest ?

the post request not idempotent delete request idempotent.

an idempotent http method http method can called many times without different outcomes

idempotency important in building fault-tolerant api.

suppose client wants update resource through post. since post not idempotent method, calling multiple times can result in wrong updates. happen if sent out post request server, timeout. resource updated? timeout happened during sending request server, or response client? can safely retry again, or need figure out first has happened resource? using idempotent methods, not have answer question, can safely resend request until response server.

so, if use post deleting, there consequences.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -