7 تغريدة Apr 13, 2023
What's the difference between PUT and PATCH
Thread 🧵👇
APIs employ various HTTP methods but PUT, and PATCH are likely the two that cause the most confusion.
The resources can be updated or modified using either one of them.
Let's discuss how these approaches differ from one another.
📌 PUT
The PUT method offers a technique to edit resources by delivering data that updates the entire resource.
PUT will completely swap out a resource if it already exists and creates the resource if it doesn't exist.
Imagine you wish to update the user using an API.
We transmit all of the resource's attributes along with the PUT request.
PUT API request consumes more bandwidth than PATCH because we send all of the resource's contents using it.
📌 PATCH
It's an alternate technique for upgrading resources.
In this instance, the client provides a portion of the modified data rather than changing the complete resource.
Fields that are not part of the payload won't be updated.
We're sending an email and an avatar.
PATCH consumes less bandwidth than PUT because we only send information that needs to be updated.
Thanks for reading!
Follow us @Rapid_API for more exclusive content. 🐙💙

جاري تحميل الاقتراحات...