Example 2996

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": "Andy Rath",
"email": "Eliza.Olson-Pagac48@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Amber Schimmel",
"email": "Allan.Hermann@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "9220de2a-57e6-473c-b98b-2b367862cbd0"
}
delay_ms: 92 # simulated latency
}

See also