Example 6687

API Mock

Mock API response payloads for testing.

# Mock API definition
{
endpoint: "/api/v1/users"
method: "GET"
status: 200
# JSON response body
response: """
[
{
"id": 1,
"name": "Candice Schumm",
"email": "Lexi.Toy@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Graciela Schoen",
"email": "Tanya.Ritchie33@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "5503e8ca-d665-495f-8dec-67af7ebfa0fa"
}
delay_ms: 483 # simulated latency
}

See also