## MedplumClient.updateResource() method

Updates a FHIR resource.

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

**Signature:**

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

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| resource | T | The FHIR resource to update. |
| options | [MedplumRequestOptions](/content/docs/sdk/core.medplumrequestoptions) | _(Optional)_ Optional fetch options. |

**Returns:**

Promise< [WithId](/content/docs/sdk/core.withid) <T>>

The result of the update operation.

## Example

Example:

```typescript
const result = await medplum.updateResource({

resourceType: 'Patient',

id: '123',

name: [{

family: 'Smith',

given: ['John']

}]

});

console.log(result.meta.versionId);
```

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

- [MedplumClient.updateResource() method](/content/docs/sdk/core.medplumclient.updateresource#medplumclientupdateresource-method/index.html)
- [Parameters](/content/docs/sdk/core.medplumclient.updateresource#parameters/index.html)
- [Example](/content/docs/sdk/core.medplumclient.updateresource#example/index.html)
