People sometimes ask whether they should use a REST API or a FHIR API, as though they were alternatives. In fact, FHIR APIs are a kind of REST API. The difference lies in how much is specified for you.
What REST is
REST is an architectural style for web APIs. It uses standard web methods, such as GET to read and POST to create, on addresses that identify things, and it typically returns data as JSON. REST itself says nothing about the content. A REST API can expose anything: appointments, invoices, patients or weather.
That freedom is useful. A team can design a REST API that fits its own product and data. The cost is that every API is different, so each consumer must learn its particular resources, field names and behaviors.
What FHIR adds
FHIR builds on REST and specifies the content. It defines a set of healthcare resources, such as Patient, Encounter and Observation, with agreed structures and meanings. It defines how to search for resources, how to read and update them, how to describe what a server supports, and how to link resources together. A developer who understands FHIR can approach any FHIR server with a good idea of what to expect.
Side by side
- Scope: a REST API is a general style; FHIR is a healthcare-specific standard using that style.
- Data model: a custom REST API uses whatever model its designers choose; FHIR provides standard resources.
- Consistency: custom REST APIs vary widely; FHIR servers share common conventions, though implementations differ in what they support.
- Effort: a custom REST API can be quick to design for a narrow purpose; FHIR requires learning the standard but can reduce work when exchanging data with many parties.
- Fit: custom REST suits product-specific features; FHIR suits exchanging common clinical and administrative data across organizations.
When a custom REST API makes sense
A custom REST API is often the right choice for data that is specific to your product, such as application settings, workflow state or analytics. It is also reasonable when your consumers are your own applications and you want a simple, tailored interface.
When FHIR makes sense
FHIR is a strong candidate when you need to exchange common healthcare data with other organizations or products, when your customers expect standards-based access, or when you want to launch an application inside an EHR using SMART on FHIR. Using a recognized standard reduces the amount of custom documentation and integration work that each partner needs.
A hybrid approach
Many products use both. They offer FHIR for standard clinical data and a custom REST API for features unique to the product. This keeps the standardized interface clean while leaving room for functionality that FHIR does not cover.
Questions to ask
- Who will consume this API, and what do they already support?
- Is the data something FHIR already models well?
- Do customers or regulators expect standards-based access?
- How much documentation and onboarding support can we provide?
- How will we version the API and manage changes?
Whichever you choose, security, documentation and versioning matter as much as the format. A well-documented, well-secured custom API can be more useful than a poorly implemented standard one, and the reverse is also true.