Example 2497

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": "Ms. Darrick Bailey DVM",
"email": "Ava.Veum18@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Cicero Boyer",
"email": "Felipe20@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "1210a61c-a292-48cf-b224-e1a244035a41"
}
delay_ms: 286 # simulated latency
}

See also