← HTTP & APIs

Software Knowledge → 03 · HTTP & APIs → PUT

PART III · HTTP & APIs

PUT

An HTTP method commonly used to replace the current representation of a resource.

01 · What is it?

What is it?

PUT is an HTTP method commonly used to replace an existing resource with the data provided in the request.

Simple Definition: PUT usually sends the full updated version of a resource.

02 · Think of it like...

Think of it like...

Think of a resource as a form.

PUT is like replacing the entire completed form with a new version.

Old Resource→PUT→New Full Version
03 · What does it do?

What does it do?

PUT is commonly used to:

Replace a Resource
Send a Full Updated Record
Update All Main Fields
Save a New Complete Version
04 · Where is it used?

Where is it used?

PUT can be used in APIs that support full resource replacement.

User Profile
Configuration
Product Record
Customer Record
System Resource
05 · Example

Example

Use:

PUT /api/customers/2001

Request Body:

{
  "name": "ABC Trading",
  "status": "Active",
  "country": "Singapore"
}

The request sends the updated representation of customer 2001.

06 · How it connects

How it connects

Client→PUT→Resource Endpoint→Full Resource Data→Backend→Replace Resource→Response

PUT identifies a resource and sends the replacement data for that resource.

07 · Do Not Confuse

Do Not Confuse

PUT

Commonly represents a full replacement or full update.

PATCH

Commonly changes only part of a resource.

PUT = Full Update
PATCH = Partial Update

08 · Topic Glossary

Topic Glossary

English Term中文Simple English中文小白理解
PUT完整更新An HTTP method commonly used to replace a resource.通常用于完整更新或替换一个资源的 HTTP 方法。
Resource资源The data or business object being replaced.PUT 请求希望更新或替换的数据对象。
Full Update完整更新Sending a complete updated representation of a resource.将一个资源更新后的完整内容发送给系统。
Replace替换Replacing the current resource with a new version.用新的完整版本替换现有资源。
Request Body请求体The data sent as the new resource representation.PUT 请求中携带的新资源完整数据。
Endpoint接口地址The address identifying the resource to update.用来标识需要更新资源的 API 地址。
PATCH部分更新A method commonly used to change only some fields.通常只修改部分字段的 HTTP 方法。
Response响应The result returned after the PUT request.PUT 请求处理完成后返回的结果。
Backend后端The software that performs the update.负责执行资源更新操作的软件部分。
JSONJSON 数据格式A common format for PUT request data.PUT 请求中常用的数据格式。
09 · What to Remember

What to Remember

PUT is commonly used for full resource updates.

PUT sends the new representation of an existing resource.

PUT and PATCH are both update methods, but they are commonly used differently.

Existing Resource→PUT→New Full Version
↑