FHIR DrillDocs

FHIR API

Resources and the REST model

The handful of ideas everything else in FHIR builds on: resources, ids, references, versions and Bundles.

Resources#

FHIR splits healthcare data into about 150 resource types: Patient, Encounter, Observation, Condition, MedicationRequest and so on. Each resource is a JSON (or XML) document with a resourceType, an id and a meta block.

JSON
{
  "resourceType": "Observation",
  "id": "4821",
  "meta": { "versionId": "1", "lastUpdated": "2026-11-25T23:33:10.112+00:00" },
  "status": "final",
  "code": { "coding": [{ "system": "http://loinc.org", "code": "8867-4", "display": "Heart rate" }] },
  "subject": { "reference": "Patient/1234" },
  "valueQuantity": { "value": 72, "unit": "/min", "system": "http://unitsofmeasure.org", "code": "/min" }
}

The five ideas to master#

Logical id
The server-assigned id. With the type, it makes the resource's address: Patient/1234.
Business identifier
An identifier (system + value) that means something in the real world: an MRN, IHI or Medicare number. Systems match patients on identifiers, not on ids.
Reference
One resource pointing at another, as in "subject": {"reference": "Patient/1234"}. References make FHIR data a graph.
Version
Every change creates a new meta.versionId. Old versions stay readable through _history.
Bundle
A container of resources. Search results, transactions, documents and messages are all Bundles, with different type values.

The REST pattern#

Interaction HTTP URL
read GET [base]/Patient/1234
vread GET [base]/Patient/1234/_history/2
search GET [base]/Patient?family=smith
create POST [base]/Patient
update PUT [base]/Patient/1234
patch PATCH [base]/Patient/1234
delete DELETE [base]/Patient/1234
history GET [base]/Patient/1234/_history
transaction POST [base] with a Bundle body
operation GET/POST [base]/Patient/1234/$everything
capabilities GET [base]/metadata

Headers you'll use#

Header Use
Content-Type: application/fhir+json On every POST, PUT and PATCH with a FHIR body
Accept: application/fhir+json Ask for JSON (HAPI returns JSON by default anyway)
Prefer: return=representation Return the saved resource after a create or update. return=minimal returns nothing and return=OperationOutcome returns only the outcome
If-Match: W/"3" Update only if the current version is still 3
If-None-Exist: identifier=sys\|val Create only if no match exists
Prefer: respond-async Needed to start a bulk export

Errors come back as OperationOutcome#

When something goes wrong, the response body is an OperationOutcome resource listing the problems, each with a severity and a location:

JSON
{
  "resourceType": "OperationOutcome",
  "issue": [{
    "severity": "error",
    "code": "processing",
    "diagnostics": "HAPI-0450: Failed to parse request body as JSON resource. Error was: ...",
    "location": ["Patient.birthDate"]
  }]
}

Always read diagnostics first. HAPI's error codes (HAPI-0450) can be searched for online.

FHIR Drill lab docs · synthetic data only · built 2026-11-26