Example 7988

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": "Jairo Durgan",
"email": "Joan.Tremblay@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Dorris Upton",
"email": "Marcia.Jacobs@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "b41a9e18-ecd4-4e6d-ad68-b6415c9c7fe3"
}
delay_ms: 294 # simulated latency
}

See also