Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No, it is not RESTful. The only reason why you should be putting a verb (<code>force_delete</code>) into the URI is if you would need to overload GET/POST methods in an environment where PUT/DELETE methods are not available. Judging from your use of the DELETE method, this is not the case.</p> <p>HTTP error code <code>409/Conflict</code> should be used for situations where there is a conflict which prevents the RESTful service to perform the operation, but there is still a chance that the user might be able to resolve the conflict himself. A pre-deletion confirmation (where there are no real conflicts which would prevent deletion) is not a conflict per se, as nothing prevents the API from performing the requested operation.</p> <p>As Alex said (I don't know who downvoted him, he is correct), this should be handled in the UI, because a RESTful service as such just processes requests and should be therefore stateless (i.e. it must not rely on confirmations by holding any server-side information about of a request).</p> <p>Two examples how to do this in UI would be to:</p> <ul> <li><em>pre-HTML5</em>:* show a JS confirmation dialog to the user, and send the request only if the user confirms it</li> <li><em>HTML5</em>:* use a form with action DELETE where the form would contain only "Confirm" and "Cancel" buttons ("Confirm" would be the submit button)</li> </ul> <p>(*) Please note that HTML versions prior to 5 do not support PUT and DELETE HTTP methods natively, however most modern browsers can do these two methods via AJAX calls. See <a href="https://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers">this thread</a> for details about cross-browser support.</p> <hr> <p><strong><em>Update</em></strong> <em>(based on additional investigation and discussions):</em><br /></p> <p>The scenario where the service would require the <code>force_delete=true</code> flag to be present violates the <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5" rel="nofollow noreferrer">uniform interface</a> as defined in Roy Fielding's dissertation. Also, as per <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7" rel="nofollow noreferrer">HTTP RFC</a>, the DELETE method may be overridden on the origin server (client), implying that this is not done on the target server (service).</p> <p>So once the service receives a DELETE request, it should process it without needing any additional confirmation (regardless if the service actually performs the operation).</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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