Skip to content

3094 - 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": "Nora Hane",
    "email": "Moriah67@yahoo.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Tom Schoen-O'Reilly MD",
    "email": "Wyman40@yahoo.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "f4f5bbd0-777d-4408-ab22-ecca4d7fabbb"
  }
  delay_ms: 378 # simulated latency
}

See Also