News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lee Davis:
Is a HTTP DELETE request idempotent?
November 01, 2013 @ 09:15:18

Lee Davis has a new post to his site with some thoughts about RESTful APIS and the correct response to DELETE calls when a resource has already been removed. One camp says a 404 should be thrown as it's no longer there, the other says 204 a "No Content" should always be returned. Lee looks at both sides of the argument and shares some of his own thoughts too.

Recently I had a read of an interesting post by Lukas Smith (@lsmith) about the use of the DELETE method when building RESTful services. I wanted to get my thoughts down on this. Mostly to help myself, but if it helps you determine a better approach, then great. I'm nowhere near qualified enough to preach, so this is by no means a "you should do it this way / my way is correct post", just food for thought. Besides, there are probably more questions here than answers.

He talks about the idea of "idempotence" when it comes to REST APIs and how it relates back to the DELETE discussion. He points out that the term has more to do with the end result of the request and not so much about how it's handled (and any "side effects" that may come with it). Various checks on the resource in question - like "does it exist" - could be considered a side effect of its operation. In his opinion, though, the 200 series of responses are more appropriate when a resource is actually deleted.

0 comments voice your opinion now!
delete rest api idempotent opinion resource

Link: http://www.duckheads.co.uk/is-a-http-delete-requests-idempotent/491

blog comments powered by Disqus

Similar Posts

Lorna Mitchell's Blog: Accessing the Magento Web API

PHPMaster.com: PHPMaster Security Roundup

Community News: Easyrest Freamwork 1.0 Released

William Durand: REST APIs with Symfony2: The Right Way

KillerPHP.com: Why PHP should be the first language you learn


Community Events





Don't see your event here?
Let us know!


release introduction code laravel wordpress configure interview language bugfix community framework api developer podcast threedevsandamaybe list application library series project

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework