Use POST instead of PUT REST -
post:- used create , update resources
put:- used update existing resources
can use post instead of put method? , if use post method on put method, disadvantages?
if post can work of put method, why put method required?
can use post instead of put method?
yes, can. html forms, example, use post writes.
if post can work of put method, why put method required?
it didn't used be. in http/1.0, specified methods head, get, , post. put relegated appendix d: additional features.
if use post method on put method, disadvantages?
put idempotent. post not.
a request method considered "idempotent" if intended effect on server of multiple identical requests method same effect single such request....
the idempotent property applies has been requested user; server free log each request separately, retain revision control history, or implement other non-idempotent side effects each idempotent request.
idempotent methods distinguished because request can repeated automatically if communication failure occurs before client able read server's response. example, if client sends put request , underlying connection closed before response received, client can establish new connection , retry idempotent request. knows repeating request have same intended effect, if original request succeeded, though response might differ.
what means put, client can use at-least-once-delivery of request; repeatedly sending same put message across unreliable network until response received.
(this guarantee provided server, communicated fact given resource accepts put messages. it's not free, need make sure server handles messages correctly.)
notice isn't client aware of guarantee, intermediate components (proxies) can see request message -- proxy doesn't need go browser ask user if safe retry message -- put method says server providing guarantee is.
Comments
Post a Comment