Skip to content

2193 - API Mock

Mock API response payloads for testing. This is an example of a MAML document.

maml
# Mock API definition
{
  endpoint: "/api/v1/users"
  method: "GET"
  status: 200
  # JSON response body
  response: """
[
  {
    "id": 1,
    "name": "Kathleen Mraz",
    "email": "Schuyler.Thompson@gmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Clarissa Harris",
    "email": "Ward.OKon-Bins@gmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "5ed8f0c6-8645-4499-bf08-9dd836a39213"
  }
  delay_ms: 332 # simulated latency
}

See Also