Example 5792

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": "Florence Yundt I",
"email": "Ivah49@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Theresia Kirlin",
"email": "Dale.Fahey@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "75510263-803b-4661-8576-5493682619ea"
}
delay_ms: 229 # simulated latency
}

See also