Example 7481

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": "Ruth Pollich",
"email": "Brooks_Veum@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Sierra Homenick",
"email": "Hunter.Kling50@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "73150541-4af1-413d-968f-62a809cffc48"
}
delay_ms: 457 # simulated latency
}

See also