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
(Unix/macOS)%USERPROFILE%\.connekt
(Windows)
-
Adds
~/.connekt
or%USERPROFILE%\.connekt
to yourPATH
if needed -
Makes the
connekt
command 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 | bash
curl -fsSL https://raw.githubusercontent.com/Amplicode/connekt/main/install/install.bat -o %TEMP%\install-connekt.bat && %TEMP%\install-connekt.bat
connekt my-script.kts
-
Docker
must be installed and running -
curl
must be available (preinstalled on macOS, most Linux, and Windows 10+) -
On Windows:
- Use
CMD
,PowerShell
, orGit Bash
connekt.bat
is 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.10
Run 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=value2
Connekt consists of two main modules:
-
Connekt Script Definition: A Kotlin scripting library that provides a domain-specific language (
DSL
) for definingHTTP
requests, 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
Docker
container.
- Kotlin Scripting: Write scripts with the
.connekt.kts
extension using Kotlin's scripting capabilities - HTTP Methods: Support for all standard HTTP methods (
GET
,POST
,PUT
,PATCH
,DELETE
,HEAD
,OPTIONS
,TRACE
) - Request Configuration:
Headers
Query parameters
Path parameters
- Request body (
JSON
, text,form data
,multipart
) - Cookies
SSL
/TLS
configuration
- Response Handling:
JSON
parsing withJSONPath
- Response validation
- File downloads
- Handling Authorization
OAuth2
Authorization 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
Maven
dependencies 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