The HTTP PUT request method is used to create a new resource or overwrite a representation of the target resource that is known by the client. Calling this method once is similar to calling it multiple times successively as it has the same effect. Though it is idempotent, we cannot cache its response.
PUT /html file HTTP/1.1
PUT /example.html HTTP/1.1 Host: sample.com Content-type: text/html Content-length: 20 <p>New File</p>
RESPONSE: If the PUT request successfully creates a new resource, then the server informs the user by sending 201(Created) response.
HTTP/1.1 201 Created Content-Location: /example.html
If the target resource already has a representation and it is successfully modified by the request then the server must send either a 200(OK) or 204(No Content) response indicating that the response is successful.
HTTP/1.1 204 No Content Content-Location: /newexample.html
Supported Browsers: The browsers supported by HTTP | PUT are listed below:
- Google Chrome 6.0+
- Internet Explorer 9.0+
- Firefox 4.0+
- Apple Safari 5.0
- Opera 11.1
- 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 ?
- How to put string in array, split by new line in PHP ?
- CSS to put icon inside an input element in a form
- PHP | Ds\Map put() Function
- Why to put “_” in front of filename in SCSS ?
- How to put images in a box without space using Bootstrap?
- How to put a responsive clear button inside HTML input text field ?
- How to put an input element on the same line as its label?
- Express.js | app.put() Function
- How to put items underneath each other flex box in Bootstrap 4 ?
- How to put the text inside of a created icon?
- How to put two columns one below other in sidebar in Bootstrap ?
- Collect.js put() Method
- HTTP Cookies in Node.js
- HTTP GET and POST Methods in PHP
- PHP | $_FILES Array (HTTP File Upload variables)
- HTTP headers | Location
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.