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, 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.