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());| Option | Default | Description |
|---|---|---|
baseUrl | required | Absolute http or https URL of the Ovok API. Accepts a String or URI. |
tenantCode | required | Tenant the client signs in to. CMS reads always include it. |
fhirPath | fhir | Path of the FHIR API under baseUrl. |
clientId | none | OAuth client ID. Required when clientSecret is set. |
clientSecret | none | Switches the client to machine credentials. |
storage | in memory | OvokStorage that keeps the user session. |
transport | HttpClient.newHttpClient() | Java HttpClient, for proxy or executor settings. |
timeout | 30 seconds | Default request timeout. |
maxNetworkRetries | 2 | Retries for transient failures of idempotent requests. |
onUnauthenticated | no-op | Receives 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