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

Cal Evans' Blog: Accessing Twitter via Zend_Service_Twitter

Paul Jones' Blog: Regarding Underscores

Geshan Manandhar: 3 Bundles to get started with REST in Symfony 2 and some tips

7PHP.com: Zend Certifications Tips & Tricks - Michelangelo van Dam

Leszek Stachowski's Blog: php anachronic coding standards


Community Events





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


version language artisanfiles interview series security tool release composer symfony podcast community voicesoftheelephpant introduction library conference framework opinion list laravel

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