Example 2997

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": "Jerad Shanahan",
"email": "Cathy_White@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Devonte Pfeffer",
"email": "Monica_Kohler@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3a5c0425-ed75-4b69-8c09-a9cf684cc8a7"
}
delay_ms: 449 # simulated latency
}

See also