What is difference between HttpPut and HttpPatch?
When we should use HttpPut?When we should use HttpPatch?
PUT versus PATCH
PUT handles updates by replacing the entire entity.PATCH only updates the fields that you give it
Put: In some scenarios, I want to update all the column values in a table we use the PUT. Patch: In some scenarios, we need to update particular Columns' values in a table we can use Patch.
Both HTTP PUT and HTTP PATCH are HTTP methods used to update resources on the server, but they have some important differences in how they work and when they should be used.
HTTP PUT is used to replace an existing resource with a new representation of the resource. When a client sends a PUT request, the entire resource is replaced with the new representation that is included in the request payload. PUT requests are idempotent, which means that if a client sends the same request multiple times, the result should be the same as if the request was only sent once.
HTTP PATCH, on the other hand, is used to make partial updates to an existing resource. Instead of replacing the entire resource, PATCH requests allow clients to specify a set of changes to apply to the resource. The changes are typically expressed using a patch document format, such as JSON Patch or JSON Merge Patch. PATCH requests are not idempotent, which means that sending the same request multiple times may result in different outcomes.
In summary, PUT is used to completely replace a resource, while PATCH is used to apply partial updates to a resource. If you want to completely replace a resource, you should use PUT. If you want to apply partial updates to a resource, you should use PATCH.
Httpput is used to update entire object or resource.
While http patch is used to update specific field or property in an object