Skip to content

1096 - 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": "Kyle Buckridge II",
    "email": "Joanna_Reichert47@hotmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Annamae Moore",
    "email": "Beatrice_Gutmann@gmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "146f0d54-7cd4-4c41-93b0-2dd9d945855d"
  }
  delay_ms: 332 # simulated latency
}

See Also