How does FHIR REST work?

A recap of HTTP

HTTP or Hypertext Transfer Protocol is a set of rules used for exchanging information over the internet.

Image of client server - client is a browser application fetching a website

When you visit a website, your browser communicates with the server that hosts this website via HTTP. Your browser sends a request, and the server responds with the data needed to display the page. For example, when you view a website, the browser performs a GET request, and when you submit a form, it would be a POST request. GET and POST are HTTP verbs that indicate what action to perform.

The request is usually in the form VERB URL, where the URL carries information like protocol, path, query parameters, etc.

For example,

GET https://website.com/path

This type of request is a very powerful way to interact with a server and to perform essential functions such as Create, Read, Update, Delete operations, also known as CRUD Operations.

REST or Representational State Transfer is an architectural style to design interconnected systems that is based on HTTP. A system that implements REST would use REST APIs to allow clients to communicate with it.

What about FHIR?

A FHIR Server works in exactly the same way,and its RESTful APIs are a key part of the FHIR ecosystem. A FHIR server will be identified by a base URL, and every Resource on the server will be represented by a URL.

FHIR Servers can choose which interactions they support, and must provide a Capability Statement that specifies it.

Interactions are defined as follows,

VERB [base-url]/[type]/[id] {?_format=[mime-type]}

Where,

  • base-url: The FHIR server URL
  • type: The resource name, e.g. “Patient”
  • id: The logical identifier of a resource
  • mime-type: The media type of a resource, e.g. application/fhir+xml, application/fhir+json or application/fhir+turtle

For example,

GET https://server.com/fhir/Patient

where the base URL is server.com/fhir and the resource we are accessing is Patient.

Download Postman to try it yourself

https://www.postman/com/downloads

For this module, I highly recommend downloading the local version of Postman. If using the web version, you’ll have to install their extension to avoid rate limits and access localhost.

FHIR Test Servers

Here are the FHIR test servers you can use

Try it yourself

For example, to view all patients on the FHIR server, you can visit the same URL with ‘/Patient/’ appended, https://fhir-bootcamp.medblocks.com/fhir/Patient/.

Comments (0)

No comments yet. Be the first to comment!