ThorAPI PATCH operations
ThorAPI generates PATCH /{Entity}/{id} operations for generated object resources. PATCH updates selected non-null fields without replacing the complete stored record.
Use PATCH when a client has an entity-shaped partial update. Use PUT when the API contract requires a complete replacement or when clearing a field to null is part of the operation.
Request behavior
Generated PATCH operations:
- use a deterministic
patch<Entity>operation ID; - preserve the corresponding update route's security, parameters, tags, and responses;
- re-read the stored record;
- copy non-null request fields onto that record; and
- save through the generated validation and write-authorization path.
For example:
PATCH /v1/Task/8f6fb443-1c37-4bb3-8955-3246b602ca9f
Content-Type: application/merge-patch+json
Authorization: Bearer <token>
{
"status": "completed",
"completionPercentage": 100
}
Fields omitted from the request keep their stored values. A null value is not a request to clear a field under the current non-null merge contract.
Media types
Generated specifications can advertise:
application/jsonapplication/merge-patch+jsonapplication/json-patch+json
The generated runtime accepts an entity-shaped partial object and applies non-null field merge semantics. It does not document the RFC 6902 array-of-operations format. Do not send JSON Patch operation arrays unless the specific generated API explicitly defines and implements that contract.
Authorization
PATCH does not bypass generated security. The caller must have the same write access required by the generated update path, and the existing record must remain visible through owner or explicit ACL grants.
Custom delegates may add validation or side effects, but they must preserve generated authorization and server-owned audit and ownership fields.
Client guidance
- Send only fields intended to change.
- Do not send
id, owner, audit dates, trash state, or secure-field key metadata. - Use the generated TypeScript or SDK mutation when available so request and cache behavior remain aligned with the schema.
- After a successful mutation, invalidate or refresh the corresponding cached record.
- Use a domain-specific command endpoint when
nullhas business meaning that the non-null merge contract cannot express.