An HTTP client driven by Kotlin scripts.
Example:
// Basic GET Request
GET("https://api.example.com/users") {
header("Authorization", "Bearer token123")
queryParam("limit", 10)
}
//POST Request with JSON Body
POST("https://api.example.com/users") {
contentType("application/json")
body(
"""
{
"name": "John Doe",
"email": "john@example.com"
}
"""
)
}
// Handling Responses
GET("https://api.example.com/users/1") then {
val userData = jsonPath().json<Map<String, Any>>()
assertEquals("John Doe", userData["name"])
}
// Store value into variable
val userId: String by POST("https://api.example.com/users") {
contentType("application/json")
body("""{"name": "John Doe"}""")
}.then {
userId.set(jsonPath().read("$.id"))
}
// Use value from another request using variable
GET("https://api.example.com/users/$userId")For more examples and detailed documentation, see the Connekt Script Definition README.
The Connekt installer sets up a CLI tool that allows you to run Kotlin scripts inside a Dockerized runtime with environment support.
-
Downloads the Connekt launcher script (bash or batch version)
-
Installs it into your home directory at:
~/.connekt(Linux/MacOS)%USERPROFILE%\.connekt(Windows)
-
Adds
~/.connektor%USERPROFILE%\.connektto yourPATHif needed -
Makes the
connektcommand available in your terminal -
Does not download Docker images during install — images are pulled lazily on first script run
curl -sSf https://raw.githubusercontent.com/Amplicode/connekt/main/install/install.sh | bashcurl -fsSL https://raw.githubusercontent.com/Amplicode/connekt/main/install/install.bat -o %TEMP%\install-connekt.bat && %TEMP%\install-connekt.batconnekt my-script.kts-
Dockermust be installed and running -
curlmust be available (preinstalled on macOS, most Linux, and Windows 10+) -
On Windows:
- Use
CMD,PowerShell, orGit Bash connekt.batis used under the hood
- Use
You can run any .kts or .connekt.kts script with the connekt command.
Pull Connekt Docker container:
docker pull ghcr.io/amplicode/connekt:0.2.10Run container:
docker run --rm \
--add-host=host.docker.internal:host-gateway \
-v /absolute/path/to/your/scripts:/connekt/scripts \
-v /absolute/path/to/connekt.env.json:/connekt/scripts/connekt.env.json \
ghcr.io/amplicode/connekt:0.2.10 \
--env-name=dev \
--env-file=scripts/connekt.env.json \
--script=scripts/your_script_name.cnt.kt \
--env-param param1=value1 \
--env-param param2=value2Connekt consists of two main modules:
-
Connekt Script Definition: A Kotlin scripting library that provides a domain-specific language (
DSL) for definingHTTPrequests, handling responses, and managing state between requests. -
Connekt Scripting Host: A command-line tool and runtime environment for executing Connekt scripts. It can be run directly or as a
Dockercontainer.
- Kotlin Scripting: Write scripts with the
.connekt.ktsextension using Kotlin's scripting capabilities - HTTP Methods: Support for all standard HTTP methods (
GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS,TRACE) - Request Configuration:
HeadersQuery parametersPath parameters- Request body (
JSON, text,form data,multipart) - Cookies
SSL/TLSconfiguration
- Response Handling:
JSONparsing withJSONPath- Response validation
- File downloads
- Handling Authorization
OAuth2Authorization Code
- State Management:
- Variables store for sharing data between requests
- Environment configuration
- Use Cases: Group related requests into use cases for better organization
- Dependency Management: Add
Mavendependencies to your scripts
- Clone the repository
- Build the project:
./gradlew build- Run the application:
./gradlew :connekt-scripting-host:run --args="path/to/your/script.connekt.kts"- connekt-script-definition: Core library that defines the DSL for HTTP requests
- connekt-scripting-host: Command-line tool and runtime environment for executing scripts