Example 7193

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": "Arnold Labadie",
"email": "Connie_Farrell@yahoo.com",
"role": "admin"
},
{
"id": 2,
"name": "Noemi Cummings",
"email": "Alaina.Hammes52@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3cb1ac3d-cac0-459f-8c87-11e83a7c6f15"
}
delay_ms: 359 # simulated latency
}

See also