Create, Read, Update, and Delete FHIR Resources
Learning to interact with a FHIR server is one of the most practical ways to understand how health data is exchanged in real-world scenarios. In this lesson, you will use Postman to perform basic CRUD operations, Create, Read, Update and Delete, on a FHIR server.
By the end you’ll know how to,
- Create a Patient resource (POST)
- Query Patient resources (Search)
- Retrieve a Patient by ID (GET)
- Update Patient details (PUT)
- Delete the Patient from the server (DELETE)
Step 1: Prerequisites
-
Download Postman, a popular API testing platform. We recommend downloading the desktop app instead of using the browser version for complete functionality.
-
Set your base URL to the Medblocks Students’ FHIR server, an open test environment you can use for practice.
Step 2: Test the base URL
Let us confirm the server is up and running with a GET request to the base URL.
GET https://fhir-bootcamp.medblocks.com/fhir/
You’ll receive a response saying that the request is incomplete. This is the expected response, and confirms that the server is live and responding.
Step 3: Search for Patients
To see existing Patient resources, append /Patient
to the base URL.
GET https://fhir-bootcamp.medblocks.com/fhir/Patient
This returns a bundle of Patient resources, these entries are from other users who have been using the same server.
You can also run this in the browser, since the browser defaults to GET
requests. You can paste the URL and see the JSON response.
Here is the search documentation on the FHIR spec.
Step 4: Create a new Patient
Now let us add our own Patient resource.
- In Postman, set the request to:
POST https://fhir-bootcamp.medblocks.com/fhir/Patient
-
In the Body tab, choose raw and select JSON.
-
Paste your Patient JSON. Here is the example from the video,
{
"resourceType": "Patient",
"name": [
{
"given": ["Sidharth"],
"family": "Ramesh"
}
],
"telecom": [
{
"system": "email",
"value": "sidharth@medblocks.com"
}
]
}
- Hit Send. If successful, you’ll get a 201 Created response, with metadata fields automatically generated by the server, such as:
id
: the patient’s unique identifierversionId
: tracks history and version numberlastUpdated
: timestamp of last changetext
: a narrative summary of the resource
Step 5: Retrieve Patient by ID
To fetch the Patient you just created, replace {id}
with the identifier returned earlier,
GET https://fhir-bootcamp.medblocks.com/fhir/Patient/{id}
Try this in Postman or your browser to confirm that your resource was created, and see the created resource.
Step 6: Update a Patient
To update a resource, we use PUT.
As an example, let us change the name from Sidharth Ramesh to Sid Suresh and update the email to sid@medblocks.com
. To do this,
- Copy the Patient JSON from earlier
- Modify the fields you want to update
- Ensure the
id
field is included in the body - Paste the updated resource in the body. Here is an example resource, please note that the
id
is a placeholder.
{
"resourceType": "Patient",
"id": 2332,
"name": [
{
"given": ["Sid"],
"family": "Suresh"
}
],
"telecom": [
{
"system": "email",
"value": "sid@medblocks.com"
}
]
}
- Send a PUT request to the server as below.
PUT https://fhir-bootcamp.medblocks.com/fhir/Patient/{id}
The server will create a new version of the resource, e.g. versionId: 2
, and you can see your updated fields in the response.
Step 7: Delete a Patient
To remove a Patient entirely, you can use the DELETE
verb. In Postman use,
DELETE https://fhir-bootcamp.medblocks.com/fhir/Patient/{id}
You’ll receive confirmation that the resource was successfully deleted.
If you attempt to GET the same Patient will return an error, which confirms the deletion.
Working with other resources
These operations we performed with the Patient resource works very similarly with other FHIR resources. For example, to work with Observation, use /Observation
. The CRUD operations (Create, Read, Update, Delete) remain the same.
This consistency makes FHIR easy to use.
Summary
In this tutorial, we used Postman to explore the basics of interacting with a public FHIR server. We covered how to search for patients, create a new patient, retrieve patients by ID, update and delete patients.
The same operations can be used for other resources as well.
These operations form the foundation for interacting with any FHIR-compliant system. By mastering CRUD with Postman, you’re on your way to building and testing more complex healthcare workflows.