Example 10193

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": "Gregg Wolf",
"email": "Doris_Barton47@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Kyla Hilpert MD",
"email": "Carlton_Sawayn75@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "f90e7323-6e64-4064-a487-37424f7e91c9"
}
delay_ms: 123 # simulated latency
}

See also