DEV Community

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

Posted on

1 1 1 1 1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay