Note that there are some explanatory texts on larger screens.

plurals
  1. POREST, HTTP DELETE and parameters
    primarykey
    data
    text
    <h2>Is there anything non-RESTful about providing parameters to a HTTP DELETE request? </h2> <p><br> My scenario is that I'm modelling the "Are you sure you want to delete that?" scenario. In some cases, the state of the resource suggests that the requested delete may be invalid. You can probably imagine some scenarios yourself where confirmation of a delete is required <p> The solution we have adopted is to pass a parameter to the delete request to indicate that it's ok to proceed with the delete ("?force_delete=true")</p> <p>e.g.</p> <pre><code>DELETE http://server/resource/id?force_delete=true </code></pre> <p>I believe that it's still restful since:</p> <p>(a) The semantics of DELETE are not being changed - the user can still send a normal DELETE request but this <em>may fail</em> with 409 and the body of the response will explain why. I say may fail because (for reasons not worth explaining) on some occasions there is no reason to prompt the user. <p> (b) There's nothing in Roy's dissertation to suggest that it's against the spirit of REST - why would there be since HTTP is only one implementation of REST so why would passing HTTP parameters matter</p> <p><br> <strong>Can someone point me at a definitive statement that nails the reason why this isn't RESTful?</strong> <p> On a related question, if the user does not specify force_delete then I'm returning <code>409 Conflict</code> - is that the most appropriate response code?</p> <p><br></p> <h2>Follow up</h2> <p>After some further research, I think that adding parameters to the DELETE may violate several principles.</p> <p>The first is that the implementation possibly violates the "Uniform Interface" (see section 5.1.5 of <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm" rel="noreferrer">Roy's dissertation</a></p> <p>By adding 'force_delete' we're adding an additional constraint onto the already well defined DELETE method. This constraint is meaningful only to us. </p> <p>You could also argue that it violate the "5.1.2 Client-Server" since the confirmation dialogue is really a UI concern and again not all clients will want to confirm deletion.</p> <p><b>Suggestions anyone?</b></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload