Example 8593

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": "Ramon Anderson",
"email": "Arlene_Gutmann@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Mariana Huels",
"email": "Jaquelin85@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "fc997adb-90b0-42a8-9b70-82921746c0f2"
}
delay_ms: 449 # simulated latency
}

See also