Skip to main content

core.medplumclient.readhistory

Home > @medplum/core > MedplumClient > readHistory

MedplumClient.readHistory() method

Reads resource history by resource type and ID.

The return value is a bundle of all versions of the resource.

Signature:

readHistory<RT extends ResourceType>(resourceType: RT, id: string, options?: MedplumRequestOptions): ReadablePromise<Bundle<WithId<ExtractResource<RT>>>>;

Parameters

Parameter

Type

Description

resourceType

RT

The FHIR resource type.

id

string

The resource ID.

options

MedplumRequestOptions

(Optional) Optional fetch options.

Returns:

ReadablePromise<Bundle<WithId<ExtractResource<RT>>>>

Promise to the resource history.

Example

Example:

const history = await medplum.readHistory('Patient', '123');
console.log(history);

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