DEV Community

Cover image for PUT vs PATCH: Let's explore the differences
Martins Gouveia
Martins Gouveia

Posted on

PUT vs PATCH: Let's explore the differences

In summary, while PUT replaces the entire resource, PATCH allows you to update specific fields. Both methods serve different purposes, so choose the one that aligns with your use case.

PUT

The PUT method is used to send an enclosed entity of a resource to the server. If the entity already exists, the server updates its data. Otherwise, the server creates a new entity.

Use Case: Typically used for full updates when you want to replace the entire resource.

PATCH

The PATCH method is used to change or add data to existing resources. It only updates the fields that you pass, rather than the entire resource.

Use Case: Useful for partial updates when you want to modify specific parts of a resource.

Top comments (0)