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

536 questions
11
votes
3 answers

When should I use HttpDelete or HttpPut in an asp.net mvc application

I use always HttpGet or HttpPost even when my action is executing a delete method on the database. For what should I use then HttpDelete/HttpPut ?
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
10
votes
2 answers

HttpMethod.Delete not working with RestTemplate of Spring-Android

I am trying to use DELETE method of HttpMethod. The code that I am using for that is response = restTemplate.exchange(url, HttpMethod.DELETE, requestEntity, Response.class); I am also using JacksonJson for mapping json. The delete functionality…
thefrugaldev
  • 1,619
  • 4
  • 18
  • 36
10
votes
1 answer

ASP.NET Web API - 404 On Delete

I am trying to implement a Delete method on a Web API controller. However, I always get a 404 - Not Found. At this point, I have GET, POST and PUT methods that are working just fine. I've been reading a handful of the other SO posts about the same…
9
votes
1 answer

How to perform DELETE in Elixir using HTTPoison?

I want to execute the command below in Elixir using HTTPoison Library. $ curl -X DELETE -H "expired: 1442395800" -H "signature: ******************" -d '{"api_key":"***************","delete_path":"*******","expired":"****"}'…
王志軍
  • 1,021
  • 1
  • 11
  • 21
9
votes
3 answers

Spring MVC using @RequestParam with RequestMethod.DELETE on Tomcat 6.0.35

I have a simple method (running on Tomcat 6.0.35) that looks like so: @RequestMapping(value = "/bla/d", method = RequestMethod.DELETE) @ResponseStatus(HttpStatus.NO_CONTENT) public void d(@RequestParam String d){ //logic here } When I send a…
Scis
  • 2,934
  • 3
  • 23
  • 37
8
votes
1 answer

Use DELETE form method in Html.BeginForm()?

I'd like to use the appropriate HTTP method when possible. In this case, when a button is clicked to delete something, I want to fire the controller action with the attribute [HttpDelete]. However, I can't seem to create a form with this method -…
Josh M.
  • 26,437
  • 24
  • 119
  • 200
8
votes
3 answers

REST - revertable DELETE

I have a question about HTTP DELETE and REST. I have a resource x. Depending on the state of x, deletion of x does either: Delete x permanently. Mark x as deleted. This means that x can reverted later on. I assume that HTTP DELETE must delete the…
Zure Citroen
  • 161
  • 2
  • 6
8
votes
3 answers

REST delete multiple items in the batch

I need to delete multiple items by id in the batch however HTTP DELETE does not support a body payload. Work around options: 1. @DELETE /path/abc?itemId=1&itemId=2&itemId=3 on the server side it will be parsed as List of ids and DELETE operation…
Wild Goat
  • 3,509
  • 12
  • 46
  • 87
8
votes
2 answers

WCF REST service hosted in IIS does not support PUT and DELETE

I created a WCF REST (aka WebHttp) service in .NET 4, using Microsoft's WCF REST Service Template 40. I am hosting the service in IIS 6. The Service Template uses the RouteTable in the Global.asax as a way to create "clean" URL's that don't include…
Mike Taverne
  • 83
  • 1
  • 3
8
votes
3 answers

HTTP DELETE request

I'm attempting to do an HTTP DELETE in C# from my code behind and am unable to do this. After looking at the members of the WebRequestMethods.Http type, i'm not even sure that this is possible. Here is my code: try { HttpWebRequest request =…
Jeremy Cron
  • 2,404
  • 3
  • 25
  • 30
7
votes
4 answers

REST Architecture for Multiple Deletes?

I send a delete request to server as like: @RequestMapping(value = "/user/{userId}", method = RequestMethod.DELETE) for a single user delete. However what to do when multiple users wants to be deleted? I want to obey REST architecture but I want to…
kamaci
  • 72,915
  • 69
  • 228
  • 366
7
votes
2 answers

Spring @CrossOrigin does not work with DELETE method

Spring @CrossOrigin annotation does not work with DELETE methods. Example code (in Groovy): @CrossOrigin @RestController @RequestMapping('/rest') class SpringController { @RequestMapping(value = '/{fileName}', RequestMethod.DELETE) void…
Wizeek
  • 111
  • 2
  • 6
7
votes
2 answers

Spring MVC return HTTP 406 on URL with dot

I have found one very strange behaviour of Spring MVC. I have controller with method: @RequestMapping (value = "/delete/{id:.*}", method = RequestMethod.DELETE) public ResponseEntity delete(@PathVariable (value = "id") final String id) { …
Vartlok
  • 2,539
  • 3
  • 32
  • 46
7
votes
1 answer

Best way to test DELETE requests with Rspec?

I started using that way: describe "DELETE /v1/categories/{id}" do before(:each) do # Login User/Token end it 'deletes a category' do category = Fabricate(:category) category2 = Fabricate(:category) get…
Ivan Santos
  • 626
  • 2
  • 7
  • 19
7
votes
1 answer

Web API 2 DELETE method always returns 500

I have a an action on my Email Web API 2 controller: [Authorize] [RoutePrefix("api/Email")] public class EmailController : ApiController { //... [HttpDelete] [Route("Remove/{id}")] private void Remove(int id) { …
Stephen Collins
  • 3,523
  • 8
  • 40
  • 61
1 2
3
35 36