What is it?
PATCH is an HTTP method commonly used to change selected parts of an existing resource.
Simple Definition:
PATCH updates only the fields that need to change.
Software Knowledge → 03 · HTTP & APIs → PATCH
An HTTP method commonly used to update part of an existing resource.
PATCH is an HTTP method commonly used to change selected parts of an existing resource.
Simple Definition:
PATCH updates only the fields that need to change.
Think of an existing form with ten fields.
If only the status changes, PATCH can send just the new status instead of the full form.
name = ABC Trading
status = Pending
country = Singapore
status = Active
name = ABC Trading
status = Active
country = Singapore
PATCH is commonly used to:
PATCH is commonly useful for:
PATCH /api/orders/1001
{
"status": "Approved"
}Only the order status is being changed.
The other order fields do not need to be sent in this example.
PATCH focuses on the fields that need to change.
Commonly updates part of a resource.
Commonly sends a complete replacement or full update.
PATCH = Partial Update
PUT = Full Update
| ENGLISH TERM | 中文 | SIMPLE ENGLISH | 中文小白理解 |
|---|---|---|---|
| PATCH | 部分更新 | An HTTP method commonly used to update part of a resource. | 通常用于修改资源部分字段的 HTTP 方法。 |
| Partial Update | 部分更新 | Changing only selected fields of a resource. | 只修改资源中的部分字段。 |
| Field | 字段 | One piece of information inside a resource. | 一个业务对象中的某一项数据。 |
| Resource | 资源 | The data or object being updated. | PATCH 请求需要修改的数据或业务对象。 |
| Request Body | 请求体 | The changed values sent in the request. | PATCH 请求中发送的需要修改的数据。 |
| Endpoint | 接口地址 | The address identifying the resource to change. | 标识需要修改哪个资源的 API 地址。 |
| PUT | 完整更新 | A method commonly used for full resource updates. | 通常用于完整更新资源的 HTTP 方法。 |
| Status | 状态 | A field often changed using PATCH. | 经常通过 PATCH 修改的一类状态字段。 |
| Backend | 后端 | The software that applies the requested changes. | 根据 PATCH 请求执行数据修改的软件部分。 |
| Response | 响应 | The result returned after the update. | 部分更新完成后返回的结果。 |
PATCH updates part of an existing resource.
PATCH is useful when only selected fields need to change.
PATCH and PUT are commonly used for different types of updates.
Final:
Existing Resource → PATCH → Selected Changes