php - Why use PUT and DELETE when I can do it with POST or GET -


i going start using php rest frame work called slim , there documentation put , delete wondering if should bother if can delete record on database or post well.

are there advantages?

99% convention, useful convention. handy know kind of request comes in , makes api usage easier (instead of forcing dev remember add action=blah, can tell them "whenever want delete - same request, delete verb).

the 1% remaining through simple fact: using delete avoids having put parameter in get or post variables signify deletion. that's bytes saved through not having repeat choosing field modifiable, rather adding field. there no point in adding complexity when can without doing so.

things out include: idempotency of verbs. convention, - get should idempotent triggerable through browser requests. should "safe repeat".

(last useful bit: mvc frameworks split endpoints http verb. saves if!)


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -