Reading Data | Medplum

A very common operation is reading the data of a specified resource given its id. The FHIR read operation is used by sending an HTTP GET request.

Medplum also provides the readResource helper function as a part of the MedplumClient. This function takes a resourceType and id of the resource you would like to read.

Usage in Different Contexts

await medplum.readResource('Patient', 'homer-simpson');
medplum get Patient/homer-simpson
curl 'https://api.medplum.com/fhir/R4/Patient/homer-simpson' \
  -H 'authorization: Bearer $ACCESS_TOKEN' \
  -H 'content-type: application/fhir+json' \

Reading a Deleted Resource

If you attempt to read a resource with an id that does not exist, you will receive a status code of 404 Not Found. However, if you search for a resource that has been deleted you will receive a status code of 410 Gone.

Reading Multiple Resources

If you want to read multiple resources, you should use Medplum's search functionality. For more info see the Search Basics docs