Example 11898

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": "Maymie Legros",
"email": "Keara66@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Dr. Gary Swift",
"email": "Pinkie53@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "553ecb0d-a287-4874-9846-c5b684e17736"
}
delay_ms: 144 # simulated latency
}

See also