FHIR RESTful URL Anatomy¶
A FHIR REST URL follows this pattern:
| Segment | Required | Example | Notes |
|---|---|---|---|
| Base URL | Yes | https://hapi.fhir.org/baseR4 |
The FHIR server's root. Configure as the Endpoint URL on the Web Service Connection. |
| Resource type | Yes | Patient, Observation, MedicationRequest |
Full list at hl7.org/fhir/R4/resourcelist.html. |
| Resource ID | When operating on a single instance | Patient/12345 |
The server-assigned ID for one resource. |
| Sub-resource | Optional | Patient/12345/Observation |
Resources scoped under the parent. Not every server exposes every sub-resource. |
| Operation | Optional | $everything, $validate, $document |
Operations begin with $. See hl7.org/fhir/R4/operationslist.html for the standard set. Servers may add their own. |
| Query parameters | Optional | ?name=Smith&birthdate=1970-01-01 |
Search parameters and modifiers. See below. Each resource page on hl7.org lists the parameters that resource supports. |
Examples¶
GET https://hapi.fhir.org/baseR4/Patient/12345
GET https://hapi.fhir.org/baseR4/Patient/12345/$everything
GET https://hapi.fhir.org/baseR4/Patient?name=Smith&birthdate=1970-01-01
POST https://hapi.fhir.org/baseR4/Patient
PUT https://hapi.fhir.org/baseR4/Patient/12345
In QIE the URL pattern is set on the REST Web Service Sender. Node tags substitute message values into the URL at call time, for example https://hapi.fhir.org/baseR4/Patient/{PID-3} resolves the patient ID from the inbound HL7 message.
Search parameter prefixes¶
Prefixes change how a parameter value is compared. They apply to date, number, and quantity parameters. The default (no prefix) is eq.
| Prefix | Meaning | Example | Description |
|---|---|---|---|
eq |
Equal | birthdate=eq2000-01-01 |
Exact match. Default if no prefix is given. |
ne |
Not equal | birthdate=ne2000-01-01 |
Excludes records with that value. |
gt |
Greater than | birthdate=gt2000-01-01 |
After the supplied value. |
lt |
Less than | birthdate=lt2000-01-01 |
Before the supplied value. |
ge |
Greater or equal | birthdate=ge2000-01-01 |
On or after the supplied value. |
le |
Less or equal | birthdate=le2000-01-01 |
On or before the supplied value. |
sa |
Starts after | birthdate=sa2000-01-01 |
Date range starts after, and is more lenient than gt. |
eb |
Ends before | birthdate=eb2000-01-01 |
Date range ends before, and is more lenient than lt. |
ap |
Approximately | birthdate=ap2000-01-01 |
Server-defined fuzzy match around the value. |
Search modifiers¶
Modifiers attach to the parameter name with a colon. They change how the parameter is interpreted (rather than how the value is compared).
| Modifier | Meaning | Example | Description |
|---|---|---|---|
:exact |
Exact string match | name:exact=Smith |
Matches Smith only, not smith or Smyth. Without this modifier most servers do a case-insensitive starts-with match. |
:contains |
Substring match | name:contains=mit |
Matches Smith, Mitchell, etc. |
:text |
Search human-readable text | code:text=heart |
Finds resources whose code element has the substring in its text/display. |
:missing |
Field exists / does not exist | gender:missing=true |
Returns resources where the named field is absent. false returns resources where it is present. |
:not |
Negation | code:not=12345 |
Excludes matches. |
Each resource page on hl7.org publishes the search parameters it supports along with the types that determine which prefixes and modifiers are valid. For example, Patient search parameters appears at the bottom of the Patient resource page.