Example 3795

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": "Mozell Schamberger",
"email": "Stuart_Predovic74@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Cassie Sporer II",
"email": "Mayra.Prohaska@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3b6c386b-7bee-49f4-8c2b-1ef25f43b8c1"
}
delay_ms: 54 # simulated latency
}

See also