Example 16299

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": "Jannie Rolfson",
"email": "Dedrick61@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Kristin Russel PhD",
"email": "Lawrence54@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "e45edfe0-6414-4106-998e-9caca7a9ba25"
}
delay_ms: 452 # simulated latency
}

See also