Skip to content

1499 - 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": "Ms. Viola Batz",
    "email": "Angelo_Bogisich50@gmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Gwen Dooley",
    "email": "Manuel87@yahoo.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "de9ed1c4-7354-438d-a23c-329ecc7ac898"
  }
  delay_ms: 490 # simulated latency
}

See Also