Example 8094

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": "Felton Smitham",
"email": "Frances.Hintz@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Miss Gavin Boyle",
"email": "Zachary.Effertz@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "a1d9ade2-6089-4889-8138-db33e3d12b20"
}
delay_ms: 96 # simulated latency
}

See also