# OvokClient

Canonical page: https://docs.ovok.com/java-sdk/reference/ovok-client

```java
public final class OvokClient
```

Minimal FHIR reader that uses a fixed access token. Prefer [`Ovok`](/java-sdk/reference/ovok) for new code.

## Constructors [#constructors]

### OvokClient [#ovokclient]

```java
public OvokClient(URI baseUri, String accessToken)
```

Creates a client with a new `HttpClient`.

**Parameters:**

- `baseUri`: the Ovok API base URL
- `accessToken`: the bearer token sent with every request

```java
public OvokClient(URI baseUri, String accessToken, HttpClient httpClient)
```

Creates a client that sends requests through the given `HttpClient`.

**Parameters:**

- `baseUri`: the Ovok API base URL
- `accessToken`: the bearer token sent with every request
- `httpClient`: the HTTP client to use

## Methods [#methods]

### read [#read]

```java
public JsonNode read(
        String resourceType,
        String resourceId) throws IOException, InterruptedException
```

Reads one FHIR resource (`GET /fhir/R4/{resourceType}/{resourceId}`).

**Parameters:**

- `resourceType`: the FHIR resource type, such as `Patient`
- `resourceId`: the resource ID

**Returns:** the resource

**Throws:**

- [`OvokApiException`](/java-sdk/reference/ovok-api-exception): if the API answers with a non-2xx status
- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
