fhirlab
Foundations· 10 min read· hands-on

Your first Patient

Create a real Patient on the public HAPI sandbox. Tweak the JSON, re-send, read it back. The whole lifecycle in one page.

The smallest real thing you can do in FHIR

A Patient resource is just JSON. It has a name, usually a date of birth, maybe a gender, maybe a phone number. We're going to send one to a real, live FHIR server (hapi.fhir.org/baseR4) — the public sandbox the FHIR community keeps running for everyone to learn on.

The anatomy is deliberately boring. The magic is that every FHIR server in the world will accept this exact shape.

1 · Create a Patient

Press Run. Look at the response that comes back. Notice two things: the server assigned your Patient an id, and it automatically generated a human-readable text.div — a narrative summary so a human (not just a machine) can glance at the resource and understand it.

POST /Patient
Create a new Patient on the HAPI sandbox. Edit the body if you like — change the name, add a phone number — and press Run again.
POST
https://hapi.fhir.org/baseR4
Request body
Your learner tag meta.tag: loading is added automatically so you can find this resource later.
Switch the response tab to JSONPath and try $.id, then $.name[0].given. That bar lets you query the response the same way jq queries JSON on your terminal — only live, in the browser.

2 · Read it back

Every resource created on a FHIR server lives at a predictable URL: /ResourceType/{id}. Copy the id from the response above and paste it in — or just press Run with the default and read one we already made.

GET /Patient/{id}
Read a specific Patient back by id. The id auto-fills from the Patient you just created above — or paste any Patient id to read it.
GET
https://hapi.fhir.org/baseR4
URL still contains a placeholder ({ID}). Create a Patient first above, or paste an id here.

3 · Find all the patients YOU created

The HAPI sandbox is shared with everyone on the internet, so finding "your" patient in a sea of millions sounds impossible. But every resource you create through this course gets tagged with your anonymous learner ID — stored in your browser, mirrored across localStorage, IndexedDB, and a cookie so it survives most clean-ups. We then ask the server for resources matching that tag:

GET /Patient?_tag=...|{YOUR_UID}
FHIR's search syntax: ?_tag=system|code filters resources by their tag. Your UID is injected automatically.
GET
https://hapi.fhir.org/baseR4
URL still contains a placeholder ({UID}). Waiting for your anonymous ID…

The response is a Bundle. A Bundle is FHIR's way of packaging multiple resources into a single envelope — like a search results page. Try $.entry[*].resource.name[0].given in the JSONPath tab to pull out just the first names across every match.

What just happened

  • You spoke to a real FHIR server over plain HTTPS, with no SDK, no auth, no tooling. Just fetch.
  • You sent JSON in the exact shape FHIR R4 expects, and got back a resource with a server-assigned id, a version, and an auto-generated human narrative.
  • You searched by a _tag, which is one of FHIR's built-in search parameters. There are dozens more — and an entire chapter coming up on them.

Up next: the resource you'll meet in every real FHIR integration — Observation. One resource, every vital sign, every lab result, every measurement. We'll build one, link it to the patient you just created, and search for "every body-temperature reading over 38°C."