Framework
Kotlin Test Data Generation with MockHero
Client
import io.ktor.client.*
import io.ktor.client.engine.cio.*
import io.ktor.client.plugins.contentnegotiation.*
import io.ktor.serialization.kotlinx.json.*
import io.ktor.client.request.*
val client = HttpClient(CIO) { install(ContentNegotiation) { json() } }
val body = mapOf(
"tables" to listOf(
mapOf("name" to "users", "count" to 50, "fields" to listOf(
mapOf("name" to "id", "type" to "uuid"),
mapOf("name" to "email", "type" to "email")
))
)
)
val data: Map<String, List<Map<String, Any>>> = client.post("https://api.mockhero.dev/api/v1/generate") {
header("x-api-key", System.getenv("MOCKHERO_API_KEY"))
header("Content-Type", "application/json")
setBody(body)
}.body()
Get Started
M
MockHero Team
Guides and tutorials for generating realistic test data with the MockHero API.
Start generating test data for free
1,000 rows/month on the free tier. No credit card required.
Get Your API Key