The PUT method updates a specific resource or creates a new resource with the client-supplied identifier (if it does not exist). It replaces all current representations of the target resource with the uploaded content. It typically does not perform a field-by-field update (see PATCH), but may be used in this manner in some APIs to avoid the PATCH method.
Description
PUT requests are used to update existing data or create a new resource at the specified URI using the client supplied URI identifier. The data sent in a PUT request typically replaces the existing record.
Common Use Cases
- Updating existing data.
- Replacing details of a specific resource, such as a user profile.
- Uploading a complete file where the file is treated as a resource.
Examples
PUT /users/123with body data might update the information of user 123.PUT /files/profile-pic.jpgcould replace an existing profile picture with a new one.