core.medplumclient.updateresource | Medplum

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<WithId<T>>;

Parameters

Parameter Type Description
resource T The FHIR resource to update.
options MedplumRequestOptions (Optional) Optional fetch options.

Returns:

Promise< WithId >

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.