Framework
Rust Test Data Generation with MockHero
Client
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let body = json!({
"tables": [
{ "name": "users", "count": 50, "fields": [
{ "name": "id", "type": "uuid" },
{ "name": "email", "type": "email" }
]},
{ "name": "orders", "count": 200, "fields": [
{ "name": "id", "type": "uuid" },
{ "name": "user_id", "type": "ref", "ref": "users.id" },
{ "name": "total", "type": "price" }
]}
]
});
let data: serde_json::Value = client
.post("https://api.mockhero.dev/api/v1/generate")
.header("x-api-key", std::env::var("MOCKHERO_API_KEY")?)
.json(&body)
.send().await?
.json().await?;
Ok(())
}
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