Example 16898

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": "Mr. Marlon Marquardt",
"email": "Makayla_Grimes@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Adolfo Padberg",
"email": "Curtis.Quitzon@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "d585462c-8304-4e2c-941f-559a10d5019d"
}
delay_ms: 326 # simulated latency
}

See also