Skip to content

1697 - 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": "Osborne Heller",
    "email": "Grant55@yahoo.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Dr. Lyle Durgan-Zulauf",
    "email": "Danny.Lowe@hotmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "31109960-0605-49e7-b574-8da47582b40d"
  }
  delay_ms: 158 # simulated latency
}

See Also