Documentation menu

SDKs

Java & Kotlin SDK

The official Wayline SDK for Java & Kotlin: Java 11+ (java.net.http.HttpClient). Works from Kotlin. One small dependency for JSON (Jackson).

Install

Maven Central
<dependency>
  <groupId>com.wayline</groupId>
  <artifactId>wayline-java</artifactId>
  <version>0.1.0</version>
</dependency>
<!-- Gradle: implementation("com.wayline:wayline-java:0.1.0") -->

Quickstart

Set WAYLINE_API_KEY to a test key (see the Quickstart), then:

Java & Kotlin
import com.wayline.WaylineClient;
import com.wayline.model.*;

WaylineClient wayline = WaylineClient.builder()
    .apiKey(System.getenv("WAYLINE_API_KEY"))
    .build();

DistanceResponse d = wayline.distance(DistanceRequest.of("23.7925,90.4078", "23.733,90.4172").units("imperial"));
System.out.println(d.distanceMiles() + " mi, " + d.durationSeconds() + " s");

Errors

Non-2xx responses raise a typed error after retries are exhausted. Branch on code — the full list is in the error reference.

Error handling
try {
  wayline.distance(DistanceRequest.of("0,0", "0,1"));
} catch (WaylineException e) {
  System.out.println(e.code() + " " + e.status() + " " + e.requestId());
}

Configuration

OptionDefaultDescription
API keyWAYLINE_API_KEYYour live or test key. Never logged.
Base URLhttps://api.wayline.cloudOverride for staging or a proxy.
Timeout30 secondsPer attempt.
Max retries3For 429 and 5xx, with exponential backoff + jitter, honoring Retry-After.

Source and releases

Package: com.wayline:wayline-java on Maven Central. Source: packages/sdk-java. Versions follow semantic versioning; see the CHANGELOG in the package and our product changelog.

Was this page helpful?