PUT and DELETE are the two different types of HTTP request methods. HTTP protocol supports many methods to transfer data from the server or do any operation on the server. The HTTP protocol supports the following methods, e.g. GET, POST, PUT, DELETE, PATCH, COPY, HEAD, OPTIONS, etc. Before we dive into the main difference between PUT and DELETE request methods, let us look into HTTP methods.
What is PUT request method ?
It is used when the client is sending a replacement document or uploading a new document to the Web server under the request URL.
What is DELETE request method ?
It is used when the client is trying to delete a document from the web server, identified by the request URL.
Example: Let us look into an example of PUT request method.
Example: The following code demonstrates the DELETE request method.
Difference between PUT and DELETE:
|PUT Request||DELETE Request|
|It is used to Create or Modify a resource.||It is used to delete a resource identified by a URL.|
|It is idempotent.||It is also idempotent.|
|On successful resource creation, HTTP success code 201(Created).||On successful deletion of record, we can see 200 (OK) or 204 (No Content).|
- HTTP Request vs HapiJS Request in Node.js
- How to make PUT request using XMLHttpRequest by making Custom HTTP library ?
- How to make simple PUT request using fetch API by making custom HTTP library ?
- DELETE request using XMLHttpRequest by making Custom HTTP library
- Simple DELETE request using fetch API by making custom HTTP library
- Creating Responsive Grid Vanilla using HTML,CSS and Bootstrap
- Creating Navbar | Vanilla HTML CSS Vs Bootstrap
- Simple GET and POST request using Fetch API method by making custom HTTP library
- How to send a GET request from PHP?
- HTTP headers | Access-Control-Request-Headers
- Node.js | Request Module
- HTTP headers | Access-Control-Request-Method
- Simple POST request using the fetch API
- Node.js | https.request() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.