Example 13090

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": "Anna Borer",
"email": "Mitchel.Renner38@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Jackeline Walker",
"email": "Zelma99@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3d962819-18db-4c1f-881e-bbdabcf1de9b"
}
delay_ms: 131 # simulated latency
}

See also