API Reference / API Methods / Choose your HTTP client
Aug. 06, 2019

Choose your HTTP client

The Kotlin client relies on Ktor for its HTTP layer.

Ktor offers the ability to choose and configure the underlying HTTP client engine.

The complete list of supported HTTP client engines can be found here.

Note that if you don’t specify a client engine, one will be selected by default for you from the available dependencies.

Apache

1
implementation "io.ktor:ktor-client-apache:$ktor_version"
1
2
3
4
5
6
7
8
9
ClientSearch(
    ConfigurationSearch(
        applicationID = ApplicationID("Your Application ID"),
        apiKey = APIKey("Your API key"),
        engine = Apache.create {
            // Pass additional configuration here.
        }
    )
)

OkHttp

1
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
1
2
3
4
5
6
7
8
9
ClientSearch(
    ConfigurationSearch(
        applicationID = ApplicationID("Your Application ID"),
        apiKey = APIKey("Your API key"),
        engine = OkHttp.create {
            // Pass additional configuration here.
        }
    )
)

Android HttpUrlConnection

1
implementation "io.ktor:ktor-client-android:$ktor_version"
1
2
3
4
5
6
7
8
9
ClientSearch(
    ConfigurationSearch(
        applicationID = ApplicationID("Your Application ID"),
        apiKey = APIKey("Your API key"),
        engine = Android.create {
            // Pass additional configuration here.
        }
    )
)

Did you find this page helpful?

Kotlin