Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
July 11, 2022 04:03 pm GMT

The Difference between HTTP PATCH and PUT methods

PUT and PATCH might be doing the same thing of updating a resource at a location, but they do it differently

What is PUT?
PUT is a method of modifying resource where the client sends data that updates the entire resource. It is used to set an entitys information completely. PUT is similar to POST in that it can create resources, but it does so when there is a defined URI. PUT overwrites the entire entity if it already exists, and creates a new resource if it doesnt exist.

For example, when you want to change the first name of a person in a database, you need to send the entire resource when making a PUT request.

Unlike PUT, PATCH applies a partial update to the resource.

This means that you are only required to send the data that you want to update, and it wont affect or change anything else. So if you want to update the first name on a database, you will only be required to send the first parameter; the first name.


Original Link: https://dev.to/espoirndayishimiye/the-difference-between-http-patch-and-put-methods-3pa8

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To