Skip to main content

core.medplumclient.updateresource

Home > @medplum/core > MedplumClient > updateResource

MedplumClient.updateResource() method

Updates a FHIR resource.

The return value is the updated resource, including the ID and meta.

Signature:

updateResource<T extends Resource>(resource: T, options?: MedplumRequestOptions): Promise<T>;

Parameters

ParameterTypeDescription
resourceTThe FHIR resource to update.
optionsMedplumRequestOptions(Optional) Optional fetch options.

Returns:

Promise<T>

The result of the update operation.

Example

Example:

const result = await medplum.updateResource({
resourceType: 'Patient',
id: '123',
name: [{
family: 'Smith',
given: ['John']
}]
});
console.log(result.meta.versionId);

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