> For the complete documentation index, see [llms.txt](https://kohttp.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kohttp.gitbook.io/docs/master.md).

# Introduction

![](https://repository-images.githubusercontent.com/141764280/12771480-a7f9-11e9-8a41-4a1280106f8a)

[![Build Status](https://travis-ci.org/rybalkinsd/kohttp.svg?branch=master)](https://travis-ci.org/rybalkinsd/kohttp) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.github.rybalkinsd/kohttp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.github.rybalkinsd/kohttp) [![codecov](https://codecov.io/gh/rybalkinsd/kohttp/branch/master/graph/badge.svg)](https://codecov.io/gh/rybalkinsd/kohttp) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/e072bcbe3dcf4fce87e44443f0721537)](https://www.codacy.com/app/yan.brikl/kohttp?utm_source=github.com\&amp;utm_medium=referral\&amp;utm_content=rybalkinsd/kohttp\&amp;utm_campaign=Badge_Grade) [![Kotlin](https://img.shields.io/badge/Kotlin-1.3.50-blue.svg)](https://kotlinlang.org) [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Join the chat at https://gitter.im/kohttp/community](https://badges.gitter.im/kohttp/community.svg)](https://gitter.im/kohttp/community?utm_source=badge\&utm_medium=badge\&utm_campaign=pr-badge\&utm_content=badge)[![star this repo](http://githubbadges.com/star.svg?user=rybalkinsd\&repo=kohttp\&style=flat)](https://github.com/rybalkinsd/kohttp)

Kotlin DSL http client

## Features

🔹 Developers Experience-driven library without verbosity.

🔹 Native way to use http client in Kotlin.

🔹 HTTP [`GET`](/docs/core/synchronous-calls/get.md)/[`POST`](/docs/core/synchronous-calls/post.md)/[`PUT`](/docs/core/synchronous-calls/put.md)/[`HEAD`](/docs/core/synchronous-calls/head.md)/[`DELETE`](/docs/core/synchronous-calls/delete.md)/[`PATCH`](/docs/core/synchronous-calls/patch.md) requests.

🔹 [Asynchronous](/docs/core/asynchronous-calls.md) and [blocking](/docs/core/synchronous-calls.md) requests.

🔹 [Upload files](/docs/core/synchronous-calls/upload-files.md).

🔹 [Logging](/docs/core/interceptors.md#logging-interceptor-a-request-logging-interceptor) - easily dump your http requests or convert them to cURL commands.

🔹 Minimal footprint.

## Quick start

```kotlin
// Use String or URL extensions send simple request
val response = "https://my-host.com/users?admin=true".httpGet()

// Parse response with your favorite library
val users = response.toJson()

// Use sync or async methods to send your requests
// Configure method params, headers, cookies and body in a concise way
val notifications: List<Deferred<Response>> = users.forEach { user ->
    httpPostAsync {
        url("https://my-host.com/friends/push")

        param {
            "userId" to user[id]
            "eventType" to NewFriend
        }

        header {
            "locale" to "en_EN"
            cookie {
                "user_session" to "toFycNV"
                "authToken" to "d2dwa6011w96c93ct3e3493d4a1b5c8751563217409"
            }
        }
    }
}
```

## Samples

* [Android application](https://github.com/rybalkinsd/kohttp/tree/031d8b35d44233c6f3abc93b8d99cb69a92790cd/samples/android/README.md)
* [Spring Boot application](https://github.com/rybalkinsd/kohttp/tree/031d8b35d44233c6f3abc93b8d99cb69a92790cd/samples/spring/README.md) &#x20;

## About kohttp

* [Kotlin weekly](https://mailchi.mp/kotlinweekly/kotlin-weekly-124) mentioned us
* [Android weekly (CN)](https://androidweekly.io/android-dev-weekly-issue-208/) mentioned us
* [Kotlin http client. Making kohttp 0.11.0](https://medium.com/@sergei.rybalkin/kotlin-http-client-making-kohttp-0-11-0-af16fb702c86?source=friends_link\&sk=e0284c5f8028034eafd433ff5fcfcf47) - medium post
* [Write your Android network as Kotlin DSL](https://medium.com/datadriveninvestor/write-your-android-networking-as-a-kotlin-dsl-330febae503f) - medium post
* [Upload files to Google Drive with Kotlin](https://medium.com/@sergei.rybalkin/upload-file-to-google-drive-with-kotlin-931cec5252c1) - medium post
* [Production Kotlin DSL (RU + subtitles) ](https://youtu.be/4m9bS0M0Nww) - Kotlin/Everywhere talk, YouTube

## Installation

### Gradle

Kotlin DSL:

```kotlin
implementation(group = "io.github.rybalkinsd", name = "kohttp", version = "0.12.0")
```

Groovy DSL:

```groovy
implementation 'io.github.rybalkinsd:kohttp:0.12.0'
```

### Maven:

```markup
<dependency>
  <groupId>io.github.rybalkinsd</groupId>
  <artifactId>kohttp</artifactId>
  <version>0.12.0</version>
</dependency>
```

## Table of contents

* [Synchronous calls](/docs/core/synchronous-calls.md)
  * [GET](/docs/core/synchronous-calls/get.md)
  * [POST](/docs/core/synchronous-calls/post.md)
  * [PUT](/docs/core/synchronous-calls/put.md)
  * [HEAD](/docs/core/synchronous-calls/head.md)
  * [DELETE](/docs/core/synchronous-calls/delete.md)
  * [PATCH](/docs/core/synchronous-calls/patch.md)
  * [Upload files](/docs/core/synchronous-calls/upload-files.md)
  * [Generic requests](/docs/core/synchronous-calls/generic-requests.md)
* [Asynchronous calls](/docs/core/asynchronous-calls.md)
  * [async GET](/docs/core/asynchronous-calls/async-get.md)
  * [async POST](/docs/core/asynchronous-calls/async-post.md)
  * [async PUT](/docs/core/asynchronous-calls/async-put.md)
  * [async HEAD](/docs/core/asynchronous-calls/async-head.md)
  * [async DELETE](/docs/core/asynchronous-calls/async-delete.md)
  * [async PATCH](/docs/core/asynchronous-calls/async-patch.md)
  * [async Upload files](/docs/core/asynchronous-calls/async-upload-files.md)
  * [async Generic requests](/docs/core/asynchronous-calls/generic-requests.md)
* [Response usage](/docs/core/response-usage.md)
* [Interceptors](/docs/core/interceptors.md)
* [Customisation](/docs/core/customisation.md)
* [Experimental features](/docs/core/experimental-features.md)
* [Changelog](/docs/history/changelog.md)
