PUT and a PATCH endpoint.
The
PATCH body is merged into the current record following JSON Merge Patch (RFC 7386), and the result goes through the same validations as PUT.
Example
To change only the description of a product:PATCH /api/v1/products/{productId}
PUT would have cleared every field you did not send.
Send null to clear a field:
PATCH /api/v1/products/{productId}
Things to watch
- Field names are matched case-insensitively;
descriptionandDescriptionare the same field. - If a field has a default (for example
4for a productProductType), sendingnullresets it to that default. - Lists are replaced as a whole, not merged.
- If the body is not a JSON object, or contains a name that is not a field of the resource (a typo, or an ID such as
GroupDetailId1where the field takes a name), the request is rejected with0002. Related records are sent by code or name, never by ID. - The record is read, merged and then written; if two requests change the same record at the same time, the last write wins.