## MedplumClient.searchOne() method

Sends a FHIR search request for a single resource.

This is a convenience method for `search()` that returns the first resource rather than a `Bundle`.

**Signature:**

```typescript
searchOne<RT extends ResourceType>(resourceType: RT, query?: QueryTypes, options?: MedplumRequestOptions): ReadablePromise<WithId<ExtractResource<RT>> | undefined>;
```

## Parameters

| Parameter      | Type                                                        | Description                                                                                          |
|----------------|-------------------------------------------------------------|------------------------------------------------------------------------------------------------------|
| resourceType   | RT                                                          | The FHIR resource type.                                                                               |
| query          | [QueryTypes](/content/docs/sdk/core.querytypes) | _(Optional)_ Optional FHIR search query or structured query object. Can be any valid input to the URLSearchParams() constructor. |
| options        | [MedplumRequestOptions](/content/docs/sdk/core.medplumrequestoptions) | _(Optional)_ Optional fetch options.                                                                 |

**Returns:**

[ReadablePromise](/content/docs/sdk/core.readablepromise) < [WithId](/content/docs/sdk/core.withid) <ExtractResource<RT>> | undefined

Promise to the first search result.

## Example

Example using a FHIR search string:

```typescript
const patient = await client.searchOne('Patient', 'identifier=123');

console.log(patient);
```

The return value is the resource, if available; otherwise, undefined.

See [FHIR search](https://www.hl7.org/fhir/search.html) for full details.
