Example 11096

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": "Mireille Dickens",
"email": "Lazaro_Flatley61@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Vance Bosco",
"email": "Lauren92@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "6a9ffb29-98d0-46bd-8ac4-aae948e29f8e"
}
delay_ms: 106 # simulated latency
}

See also