Example 16996

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": "Vincent Zulauf PhD",
"email": "Rubie.Goyette@yahoo.com",
"role": "admin"
},
{
"id": 2,
"name": "Eliseo Pouros",
"email": "Garry_Mertz@yahoo.com",
"role": "user"
}
]
"""

# Response headers
headers: {
Content-Type: "application/json"
X-Total-Count: "2"
X-Request-Id: "2d287f65-206c-4526-95b8-594dda8c4c6e"
}
delay_ms: 466 # simulated latency
}

See also