FHIR R4 API Requests and Responses
Use the FHIR R4 (4.0.1) interactions and search parameters advertised by the deployed DDFS capability statement.
Confirm the Deployed R4 Capabilities
Call GET {base}/api/fhir/r4/metadata. Use the returned CapabilityStatement as the authority for the resources, interactions, operations, and search parameters available on the deployed DDFS instance.
Common Patterns
- Search:
GET /api/fhir/r4/<Resource>?<query-parameters> - Create:
POST /api/fhir/r4/<Resource> - Read:
GET /api/fhir/r4/<Resource>/{rid} - Update:
PUT /api/fhir/r4/<Resource>/{rid} - Versioned read:
GET /api/fhir/r4/<Resource>/{rid}/_history/{vid} - Logical delete:
DELETE /api/fhir/r4/<Resource>/{rid}
A standard DELETE is a logical delete. POST /api/fhir/r4/<Resource>/{rid}/$hardDelete permanently deletes one eligible logically deleted resource. POST /api/fhir/r4/<Resource>/$purgeDeleted permanently deletes eligible logically deleted resources selected by its inputs. Both administrative operations are irreversible and require additional authorization.
Search and Paging
Common advertised controls include _count, _total, _id, _lastUpdated, _profile, and _tag. Confirm each control for the target resource.
- Treat
_countas a requested maximum page size; a page can contain fewer entries. Bundle.totalis optional, including when a supported_totalmode is requested.- Follow the URL in
Bundle.linkwhose relation isnextverbatim. Do not construct or edit the paging URL. - Repeat an actual date or instant parameter name to express a supported range, for example
birthdate=ge1980-01-01&birthdate=le1990-12-31.
FHIR search URLs can contain PHI. See Protect Sensitive Search Data.
Condition
Search: GET /api/fhir/r4/Condition
Advertised parameters include _count, _total, _id, _lastUpdated, _profile, _tag, abatement-date, category, clinical-status, code, encounter, onset-date, patient, and recorded-date.
Request Example
GET /api/fhir/r4/Condition?_id={rid}&patient=Patient/{patient-id}
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Condition"}}]}
Create Example
POST /api/fhir/r4/Condition
Content-Type: application/fhir+json
{
"resourceType": "Condition",
"code": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "44054006",
"display": "Diabetes mellitus type 2"
}
]
},
"subject": {"reference": "Patient/{rid}"}
}
Device
Search: GET /api/fhir/r4/Device
Advertised parameters include common controls plus patient, status, type, manufacturer, and model.
Request Example
GET /api/fhir/r4/Device?patient=Patient/{rid}&status=active
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Device"}}]}
DiagnosticReport
Search: GET /api/fhir/r4/DiagnosticReport
Advertised parameters include common controls plus category, code, date, patient, and status.
Request Example
GET /api/fhir/r4/DiagnosticReport?patient=Patient/{rid}&date=ge2024-01-01
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"DiagnosticReport"}}]}
Encounter
Search: GET /api/fhir/r4/Encounter
Advertised parameters include common controls plus class, date, discharge-disposition, identifier, location, patient, status, and type.
Request Example
GET /api/fhir/r4/Encounter?patient=Patient/{rid}&status=in-progress
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Encounter"}}]}
Location
Search: GET /api/fhir/r4/Location
Advertised parameters include common controls plus identifier, status, partof, name, address, address-city, address-state, and address-postalcode.
Request Example
GET /api/fhir/r4/Location?address-city=Boston&name=Main
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Location"}}]}
Patient
Search: GET /api/fhir/r4/Patient
Advertised parameters include common controls plus birthdate, death-date, family, given, identifier, and name.
Request Example
GET /api/fhir/r4/Patient?family=Doe&birthdate=ge1980-01-01&birthdate=le1990-12-31
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Patient"}}]}
Practitioner
Search: GET /api/fhir/r4/Practitioner
Advertised parameters include common controls plus identifier and name.
Request Example
GET /api/fhir/r4/Practitioner?name=Smith
Response Example
{"resourceType":"Bundle","type":"searchset","entry":[{"resource":{"resourceType":"Practitioner"}}]}
Other Resources
For Endpoint, Group, Observation, Organization, PractitionerRole, Provenance, RelatedPerson, ServiceRequest, Specimen, and any other advertised R4 resources, use the applicable resource page and deployed capability statement for the exact interaction, operation, and search-parameter list.
Status Codes
| Code | Meaning |
|---|---|
| 200 | A read, search, update, versioned read, or documented custom operation completed successfully. |
| 201 | The resource was created successfully. |
| 204 | The resource was logically deleted successfully and the response has no body. |