core.medplumclient.readresource
Home > @medplum/core > MedplumClient > readResource
MedplumClient.readResource() method
Reads a resource by resource type and ID.
Signature:
readResource<K extends ResourceType>(resourceType: K, id: string, options?: RequestInit): ReadablePromise<ExtractResource<K>>;
Parameters
Parameter | Type | Description |
---|---|---|
resourceType | K | The FHIR resource type. |
id | string | The resource ID. |
options | RequestInit | (Optional) Optional fetch options. |
Returns:
ReadablePromise<ExtractResource<K>>
The resource if available; undefined otherwise.
Example
Example:
const patient = await medplum.readResource('Patient', '123');
console.log(patient);
See the FHIR "read" operation for full details: https://www.hl7.org/fhir/http.html\#read