Example 12882

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": "Sheldon Mann Jr.",
"email": "Lois97@hotmail.com",
"role": "admin"
},
{
"id": 2,
"name": "Anna Lakin",
"email": "Dortha_Greenfelder@gmail.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "3333703b-b07f-4cb9-ae1b-7672bd23c025"
}
delay_ms: 294 # simulated latency
}

See also