Questions tagged [http-delete]

DELETE is an HTTP request method used to delete a specified resource on server side.

DELETE is an HTTP method which requests that the origin server delete the resource identified by the request URL. This method may be overridden by human intervention (or other means) on the origin server. The client cannot be guaranteed that the operation has been carried out, even if the status code returned from the origin server indicates that the action has been completed successfully. However, the server should not indicate success unless, at the time the response is given, it intends to delete the resource or move it to an inaccessible location.

A successful response should be 200 (OK) if the response includes a response body describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include a response body.

If the request passes through a cache and the URL identifies one or more currently cached entities, those entries should be treated as stale. Responses to this method are not cacheable.

References- apache.org, w3.org

480 questions
157
votes
5 answers

What REST PUT/POST/DELETE calls should return by a convention?

According to the "REST ideology" what should be in the response body for a PUT/POST/DELETE requests? What about return codes? Is HTTP_OK enough? What is the reason for such conventions, if any? I've found a good post describing POST/PUT…
tuxSlayer
  • 2,734
  • 2
  • 18
  • 24
151
votes
12 answers

Axios Delete request with body and headers?

I'm using Axios while programing in ReactJS and I pretend to send a DELETE request to my server. To do so I need the headers: headers: { 'Authorization': ... } and the body is composed of var payload = { "username": .. } I've been searching…
Asfourhundred
  • 1,701
  • 2
  • 10
  • 15
145
votes
4 answers

Deleting a resource using http DELETE

So, given that the DELETE verb in Http is idempotent, when I issue the following request, what should happen the second (or third, or fourth, etc...)? DELETE /person/123 The first time, the resource is deleted and I return a 204 (successful, no…
Craig Wilson
  • 10,844
  • 3
  • 37
  • 42
136
votes
9 answers

How to send PUT, DELETE HTTP request in HttpURLConnection?

I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS requests but I still haven't found…
Matrix
  • 7,431
  • 13
  • 61
  • 93
87
votes
2 answers

Is a response-body allowed for a HTTP-DELETE-request?

I assume the response code 200 always allows for a response-body, but I can't find any explicit mention of response-bodies for DELETE-requests.
scrrr
  • 4,684
  • 5
  • 39
  • 44
72
votes
13 answers

Body of Http.DELETE request in Angular2

I'm trying to talk to a somewhat RESTful API from an Angular 2 frontend. To remove some item from a collection, I need to send some other data in addition to the removée unique id(that can be appended to the url), namely an authentication token,…
TriTap
  • 840
  • 1
  • 6
  • 9
70
votes
4 answers

How do I enable HTTP PUT and DELETE for ASP.NET MVC in IIS?

I use HTTP PUT and DELETE in my ASP.NET MVC3 application. When I run it in local, every thing works correctly; But when I publish the application to the server, these methods do not work. Are there any special settings for enable a web server to…
agent47
  • 6,467
  • 15
  • 50
  • 79
66
votes
5 answers

HTTP protocol's PUT and DELETE and their usage in PHP

Introduction I've read the following: Hypertext Transfer Protocol (HTTP) is the life of the web. It's used every time you transfer a document, or make an AJAX request. But HTTP is surprisingly a relative unknown among some web developers. The HTTP…
user4446130
62
votes
6 answers

RESTful undelete

It is a fairly common requirement to support undeletes or delayed/batched deletions for data services. What I'm wondering is how to implement this in a RESTful way. I'm torn between a few different options (none of which seems terribly attractive to…
Caleb
  • 641
  • 5
  • 7
60
votes
7 answers

Javascript: Fetch DELETE and PUT requests

I have gotten outside of GET and POST methods with Fetch. But I couldn't find any good DELETE and PUT example. So, I ask you for it. Could you give a good example of DELETE and PUT methods with fetch. And explain it a little bit.
Kirill Stas
  • 929
  • 3
  • 9
  • 14
53
votes
2 answers

DELETE using CURL with encoded URL

I’m trying to make a request using CURL like this: curl -X DELETE "https://myhost/context/path/users/OXYugGKg207g5uN/07V" where OXYugGKg207g5uN/07V is a hash, so I suppose that I need to encode before do this request. I have tried curl -X DELETE…
coffee
  • 2,878
  • 4
  • 27
  • 46
42
votes
5 answers

HttpDelete with body

I'm attempting to use an HttpDelete object to invoke a web service's delete method. The web service's code parses JSON from the message's body. However, I'm failing to understand how to add a body to an HttpDelete object. Is there a way to do…
Andrew
  • 19,726
  • 30
  • 93
  • 171
40
votes
6 answers

How to specify DELETE method in a link or form?

Rfc2616 lists many methods besides GET and POST, like, say, DELETE, PUT etc. Method field in html forms, though, seems to be allowed to specify only GET or POST. Is it possible to create a link or form in a html page that uses a request method that…
37
votes
10 answers

Why should you delete using an HTTP POST or DELETE, rather than GET?

I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page http://www.asp.net/learn/mvc/tutorial-32-cs.aspx The following statement is made towards the bottom of this page: In general, you don’t want to perform an HTTP…
Richard Ev
  • 48,781
  • 54
  • 181
  • 273
23
votes
1 answer

RESTful Http DELETE method in .NET

I am new to web services. I am dealing with testing APIs in my project. In the previous version the company used GET and POST methods but not PUT and DELETE methods. I need help for the HTTP DELETE method. I have browsed various websites where I…
VIBA
  • 233
  • 1
  • 2
  • 4
1
2 3
31 32