Example 4498

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": "Cheryl Torphy",
"email": "Ozella_Watsica@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Isac Ward",
"email": "Sean3@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "582117b4-115e-46b1-88b9-feea83472417"
}
delay_ms: 221 # simulated latency
}

See also