Example 17186

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": "Jermaine Abernathy",
"email": "Ada.Zboncak9@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Miriam Buckridge",
"email": "Bobbie.Boyer21@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "f2b01eb9-3304-483a-910a-15ae54adcee0"
}
delay_ms: 141 # simulated latency
}

See also