Diffrence between Put and Patch
PUT: Imagine you're replacing the entire contents of a document. With PUT, you send the complete updated version of the data to the server. It's like rewriting the whole document.
PATCH: This is like editing specific parts of a document. You only send the changes you want to make, leaving the rest untouched.
Example:
Let's say you have a user profile with information like name, email, and phone number.
PUT: If you want to update the entire profile with new data for all fields (name, email, phone), you'd use PUT and send the complete new user information.
PATCH: If you only want to change the user's email address, you'd use PATCH and send just the updated email information.
Here's the key difference:
PUT: Replaces the entire resource.
PATCH: Updates specific parts of a resource.
Comments
Post a Comment