Skip to content

1295 - 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": "Marianne Mayer",
    "email": "Cleo_Murray@gmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Sidney Gorczany",
    "email": "Clarissa.Dicki81@gmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "6b61a126-3022-46a6-82cd-7cf1d272805d"
  }
  delay_ms: 315 # simulated latency
}

See Also