Smile Guide: RESTful FHIR
What to Expect
🕘 Reading time = 20 minutes
This document is intended to teach you about FHIR’s RESTful API. By the end of this guide, you’ll be able to:
1. Identify the different parts that form a basic query
2. Describe the different parts of a query result
3. Create and execute FHIR queries
4. Customize FHIR queries with modifiers and custom parameters
You’ll be relieved to know you don’t need to be a coding expert to understand REST and use it successfully. This document will cover some of the basics of RESTful FHIR and coding techniques. While performing the exercises in this document, you will gain valuable experience in creating and executing queries against any FHIR repository—from the basics to many advanced features.
This is an interactive document and, as such, you should have access to a FHIR server—either your own, or reading how to access Smile Digital Health’s playground. By the end of this document, you should be comfortable searching, accessing and manipulating FHIR data.
Welcome to the world of FHIR. We hope you enjoy your journey!
Note: If you already understand REST basics jump to “Exercises” on page 11.
What Is REST?
API’s are application programming interfaces. REST (Representational State Transfer) is an API coding style designed to provide easy uniform standards across the internet (More Information can be found here). RESTful systems are characterized by how they separate client and server requests. In RESTful API’s, server implementations and client implementations can be done independently. In common practice, this means clients can take advantage of a server’s data and methods (functions) without knowing the inner-workings of the server. For example, Google Maps publishes APIs with which any third-party client can interact. FHIR uses REST to expose and manipulate FHIR resources.
For a beginner’s guide on REST, check out this video: What Is a RESTful API?
Figure 1: Overview of RESTful client-server interaction
The following are required:
It’s useful if Smile is already installed. If it’s not installed, check out this guide. Throughout this tutorial, we’ll be using the open source endpoint http://hapi.fhir.org/baseR4 which does not necessarily require a local instance of Smile running.
It’s assumed that there’s an understanding of Smile
Either Postman or Insomnia are downloaded and the reader has experience using the application. This document will use Postman for all the query examples. However, you can use Insomnia instead. Postman and Insomnia are API clients that make it easy for developers to create, share, test and document restful APIs.