Example 11282

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": "Elena Lang",
"email": "Marvin_Mertz@yahoo.com",
"role": "admin"
},
{
"id": 2,
"name": "Summer Hudson",
"email": "Claudine67@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "b0893a0d-c665-4b2b-a118-24be7174f538"
}
delay_ms: 177 # simulated latency
}

See also