> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.noyax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Partial update

> The difference between PUT and PATCH, and the JSON Merge Patch rules.

You do not have to send the whole body to change a single field. Every updatable resource has both a `PUT` and a `PATCH` endpoint.

|                        | `PUT`                       | `PATCH`                      |
| ---------------------- | --------------------------- | ---------------------------- |
| Field that is not sent | **Cleared**                 | **Unchanged**                |
| Field sent as `null`   | Cleared                     | Cleared                      |
| Use it when            | You manage the whole record | You change individual fields |

The `PATCH` body is merged into the current record following [JSON Merge Patch (RFC 7386)](https://datatracker.ietf.org/doc/html/rfc7386), and the result goes through **the same validations as PUT**.

## Example

To change only the description of a product:

```json PATCH /api/v1/products/{productId} theme={null}
{
  "Description": "New description"
}
```

The code, name, unit, VAT rate and every other field of the product stay as they are. The same request sent with `PUT` would have cleared every field you did not send.

Send `null` to clear a field:

```json PATCH /api/v1/products/{productId} theme={null}
{
  "Gtip": null,
  "VatRateId": null
}
```

## Things to watch

<Warning>
  Validation runs on the record **after** the merge. Setting a required field to `null` (such as `"Code": null`) is rejected with the required-field error of that resource.
</Warning>

* Field names are matched case-insensitively; `description` and `Description` are the same field.
* If a field has a default (for example `4` for a product `ProductType`), sending `null` resets it to that default.
* Lists are replaced as a whole, not merged.
* If the body is not a JSON object, the request is rejected with `0002`.
* The record is read, merged and then written; if two requests change the same record at the same time, the last write wins.
