Skip to content

1384 - 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": "Lea Stiedemann",
    "email": "Sally_Maggio@hotmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Joanne Yost",
    "email": "Cora.Homenick80@gmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "5b7cb1a9-e967-477c-95d7-ce6ffb7b1504"
  }
  delay_ms: 203 # simulated latency
}

See Also