Example 8993

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": "Alford Gibson",
"email": "Lucas74@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Michelle Rau",
"email": "Wilfred.Boehm@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "94484294-fe79-4a2f-8050-b1b155f653a3"
}
delay_ms: 383 # simulated latency
}

See also