Client configuration

Build an OvokConfig and pass it to new Ovok(config).

  • Stable unknown
  • Release candidate since 0.1.0-rc.1
  • Development since 0.1.0-dev+fa3c303

Build an OvokConfig and pass it to new Ovok(config).

Ovok ovok = new Ovok(OvokConfig.builder()
        .baseUrl("https://api.sandbox.ovok.com")
        .tenantCode("your-tenant")
        .timeout(Duration.ofSeconds(30))
        .maxNetworkRetries(2)
        .build());
OptionDefaultDescription
baseUrlrequiredAbsolute http or https URL of the Ovok API. Accepts a String or URI.
tenantCoderequiredTenant the client signs in to. CMS reads always include it.
fhirPathfhirPath of the FHIR API under baseUrl.
clientIdnoneOAuth client ID. Required when clientSecret is set.
clientSecretnoneSwitches the client to machine credentials.
storagein memoryOvokStorage that keeps the user session.
transportHttpClient.newHttpClient()Java HttpClient, for proxy or executor settings.
timeout30 secondsDefault request timeout.
maxNetworkRetries2Retries for transient failures of idempotent requests.
onUnauthenticatedno-opReceives an UnauthenticatedReason when the token service rejects the session.

An invalid option throws OvokConfigException from build().

Session storage

The default storage keeps the session in memory, so it is lost when the process exits. To keep it, implement OvokStorage:

public interface OvokStorage {
    String getItem(String key);
    void setItem(String key, String value);
    void removeItem(String key);
}

The client stores the session under ovok:<tenantCode>:session.

Machine clients

Set clientId and clientSecret to use client credentials. The client fetches and refreshes its own token. User sign-in methods such as login throw OvokConfigException on a machine client.

Ovok machineClient = new Ovok(OvokConfig.builder()
        .baseUrl("https://api.sandbox.ovok.com")
        .tenantCode("your-tenant")
        .clientId(System.getenv("OVOK_CLIENT_ID"))
        .clientSecret(System.getenv("OVOK_CLIENT_SECRET"))
        .build());

Last updated on

On this page