Example 9593

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": "Darlene Crooks",
"email": "Marcelina_Flatley49@gmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Phillip Flatley",
"email": "Robbie_Bins@hotmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "9b36e56a-ec7b-4de8-9159-984c580dd3a6"
}
delay_ms: 150 # simulated latency
}

See also