Skip to content

2296 - 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": "Abraham Herman",
    "email": "Sheldon.Simonis72@yahoo.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Jovany Frami",
    "email": "Maryann_Terry@gmail.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "a2d42f8e-c26c-4529-abcf-23deb46f3f4a"
  }
  delay_ms: 314 # simulated latency
}

See Also