Implementation Features
Spec: FHIR RESTful API| Feature | Support | Notes |
|---|---|---|
| Create (POST) | β Full | Server-assigned IDs |
| Read (GET) | β Full | With ETag support |
| Update (PUT) | β Full | Update-as-create configurable |
| Patch (PATCH) | β JSON Patch | RFC 6902 format |
| Delete | β Configurable | Soft delete (default) or hard delete |
| Conditional Create | β Full | Via If-None-Exist |
| Conditional Update | β Full | Via query parameters |
| Conditional Delete | β Full | Single match required |
| Versioning | β Full | Sequential integer versionIds |
Conditional References (Search URIs)
TLQ FHIR supports conditional references inside request resources by allowing a search URI inReference.reference (FHIR βsearch URIsβ):
- 1 match: TLQ FHIR rewrites the reference to
Patient/{id}and persists the rewritten form. - 0 matches or 2+ matches: request fails with
412 Precondition Failedand no write occurs. - Only filter search parameters are allowed (e.g.
_count,_sort,_include,_revinclude,_elements,_summaryare rejected).
POST, PUT, and PATCH (including conditional interactions), and also to bundle
processing (batch / transaction).
Create Behavior
Spec: create, conditional create, update-as-createServer-Assigned IDs
When creating withPOST, TLQ FHIR generates UUIDs as resource IDs:
Client-Assigned IDs
Theallow_update_create configuration option allows PUT to create resources if they donβt exist (enabled by default).
Basic Checks on Create
By default, TLQ FHIR performs basic structural checks on creates:- Resource Type: Validates that
resourceTypematches the endpoint - Resource Type Name: Ensures the resource type is a known FHIR resource type
FHIR Validation: Full FHIR validation (cardinality, data types, profiles,
etc.) is not yet implemented but will be in the future.
Conditional Create
TLQ FHIRβs conditional create follows FHIR spec:- 0 matches: Creates new resource β
201 Created - 1 match: Returns existing resource β
200 OKwithLocationheader - 2+ matches: Rejects as ambiguous β
412 Precondition Failed
Read Behavior
Spec: read, Concurrency Management (ETag/If-Match), Support for HEADETag Support
Every read returns a weak ETag header for optimistic locking:If-Match on updates to prevent lost updates:
Deleted Resources
Reading a deleted resource behavior depends on delete mode: Soft Delete (default):- Returns
410 Gonefor deleted resources - History remains accessible via
GET /Patient/123/_history/5
hard_delete: true):
- Returns
404 Not Found(resource completely removed) - History is not accessible (all versions deleted)
HEAD Requests
Check resource existence without fetching body:Update Behavior
Spec: update, update-as-create, conditional update, Concurrency Management (If-Match)Version Tracking
TLQ FHIR uses sequential integer versions starting at 1:Optimistic Locking
Always useIf-Match for safe updates:
If-Match:
- TLQ FHIR accepts the update (no concurrency protection)
- Last write wins (can lose concurrent changes)
If-Match:
- TLQ FHIR rejects if version doesnβt match β
412 Precondition Failed - Client must refetch, merge changes, and retry
Conditional Update
Update by search criteria:- 0 matches: Creates new resource (if
allow_update_createenabled) β201 Created - 1 match: Updates that resource β
200 OK - 2+ matches: Rejects as ambiguous β
412 Precondition Failed
Patch Behavior
Spec: patch, JSON Patch (RFC 6902)JSON Patch Support
TLQ FHIR supports JSON Patch (RFC 6902) format:add, remove, replace, move, copy, test
Narrative Handling
TLQ FHIR automatically removestext (narrative) after applying patches:
Why? Narrative is auto-generated HTML that describes the resource. After a
patch, the narrative no longer matches the data, so TLQ FHIR removes it to prevent
confusion.
Patch Result Checks
After applying patch operations, TLQ FHIR performs basic structural checks:- Patched resource must remain a valid JSON object
- Resource type and ID are preserved (cannot be changed via patch)
FHIR Validation: Full FHIR validation of the patched result is not yet
implemented. The patched resource is stored as-is after basic structural
checks.
Atomic Patches
All operations in a patch are atomic:- Either all operations succeed, or none do
- Failed operation rolls back the entire patch
- Version number only increments if all operations succeed
Conditional Patch
Delete Behavior
Spec: delete, conditional deleteSoft Delete (Default)
TLQ FHIR uses soft delete by default (hard_delete: false):
- Resource marked as deleted in database
- History preserved and accessible
GET /Patient/123β410 GoneGET /Patient/123/_history/5β200 OK(still accessible)- Creates a new version entry marking the resource as deleted
Hard Delete
Whenhard_delete: true is configured:
- Resource physically removed from database
- All history versions permanently deleted
GET /Patient/123β404 Not Found(not410 Gone)- History endpoints return
404 Not Found - No new version created (complete removal)
- Enables deletion of history endpoints (
DELETE /Patient/123/_history)
Delete Response
Prefer header:
Idempotent Delete
Deleting an already-deleted resource succeeds:Conditional Delete
- 0 matches: No-op, returns
204 No Content - 1 match: Deletes that resource β
204 No Content - 2+ matches: Rejects as ambiguous β
412 Precondition Failed
Performance Considerations
Spec (Batch/Transaction): batch/transactionIndexing
TLQ FHIR automatically indexes:- Resource ID (primary key)
- Version ID
- Last updated timestamp
- Common search parameters (identifier, name, etc.)
Batch Creates
For bulk data loading, use Batch/Transaction instead of individual creates:- Single database transaction
- Reduced network overhead
- Better error handling
Error Handling
Spec: HTTP Status Codes, OperationOutcome All errors returnOperationOutcome with details:
| HTTP Status | Meaning | Example |
|---|---|---|
400 Bad Request | Invalid resource | Invalid structure or format |
404 Not Found | Resource doesnβt exist | Wrong ID |
409 Conflict | Version conflict | Conflict during operation |
410 Gone | Resource deleted | Reading deleted resource |
412 Precondition Failed | Conditional operation failed | Multiple matches found |
Error Responses
TLQ FHIR returnsOperationOutcome resources for errors with diagnostic information:
Configuration
Spec (Capability Declaration): CapabilityStatement Key configuration options for CRUD operations:Testing Your Implementation
Spec (Capabilities): capabilities (GET [base]/metadata)
Use the interactive API playground to test CRUD operations:
Next Steps
Spec: search, batch/transaction, historySearch Operations
Query resources efficiently
Batch & Transaction
Perform multiple operations atomically
Versioning & History
Access resource history
Related Documentation
- Background: Learn FHIR: CRUD
- Endpoints: Create, Read, Update, Patch, Delete
- Multi-request writes: Learn FHIR: Batch & Transaction