Skip to main content

core.medplumclient.readreference

Home > @medplum/core > MedplumClient > readReference

MedplumClient.readReference() method

Reads a resource by Reference.

This is a convenience method for readResource() that accepts a Reference object.

Signature:

readReference<T extends Resource>(reference: Reference<T>, options?: RequestInit): ReadablePromise<T>;

Parameters

ParameterTypeDescription
referenceReference<T>The FHIR reference object.
optionsRequestInit(Optional) Optional fetch options.

Returns:

ReadablePromise<T>

The resource if available; undefined otherwise.

Example

Example:

const serviceRequest = await medplum.readResource('ServiceRequest', '123');
const patient = await medplum.readReference(serviceRequest.subject);
console.log(patient);

See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html\#read