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
Copy
1
implementation "io.ktor:ktor-client-apache:$ktor_version"
Copy
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
Copy
1
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
Copy
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
Copy
1
implementation "io.ktor:ktor-client-android:$ktor_version"
Copy
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.
}
)
)