Example 17793

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": "Amaya Lebsack",
"email": "Maurice77@yahoo.com",
"role": "admin"
},
{
"id": 2,
"name": "Mr. Matilde Jaskolski",
"email": "Nick.Corwin28@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "4da6f1cc-2086-4ee9-8b31-7cde9dc2580b"
}
delay_ms: 332 # simulated latency
}

See also