Example 13882

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": "Elisa Schuppe",
"email": "Amparo.Reichel81@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Dave Kuhlman-Kshlerin",
"email": "Tyrell67@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "13b33ba6-c446-4fb3-9ade-1871ef176e01"
}
delay_ms: 110 # simulated latency
}

See also