Example 6690

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": "Sandy Schaefer",
"email": "Eudora.Streich31@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Malvina Becker",
"email": "Grant_Jakubowski@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "474860a7-b2db-4e8b-af1e-5096118b85ae"
}
delay_ms: 359 # simulated latency
}

See also