# Какая разница между методами PUT и PATCH?

Разница между **PUT** и **PATCH** в том, как они обновляют ресурс на сервере:

***

#### **PUT**

* Используется для **полного обновления ресурса**.
* Клиент отправляет **всю сущность целиком**, даже если изменилось только одно поле.
* Если чего-то нет в запросе → на сервере это поле может обнулиться или сброситься.

**Пример:**\
Есть пользователь:

```json
{
  "id": 1,
  "name": "Alex",
  "email": "alex@test.com"
}
```

Запрос:

```http
PUT /users/1
{
  "id": 1,
  "name": "Bob"
}
```

Результат: поле `email` может стереться, так как оно не было передано.

***

#### **PATCH**

* Используется для **частичного обновления ресурса**.
* Клиент отправляет **только изменённые поля**.
* Остальные данные остаются без изменений.

**Пример:**

```http
PATCH /users/1
{
  "name": "Bob"
}
```

Результат: изменится только `name`, а `email` сохранится.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kaze.gitbook.io/qa-theory/web/kakaya-raznica-mezhdu-metodami-put-i-patch.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
