Example 15095

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. Rogelio Koelpin",
"email": "Lora.Wiza@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Darien Hand",
"email": "Elsa.Hand@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "94149ecf-cd7b-4ead-b6ca-5c18d3dd0585"
}
delay_ms: 121 # simulated latency
}

See also