Skip to content

1482 - 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": "Dr. Aubrey Wilderman",
    "email": "Vicki72@hotmail.com",
    "role": "admin"
  },
  {
    "id": 2,
    "name": "Mrs. Rashawn Dooley",
    "email": "Leann95@yahoo.com",
    "role": "user"
  }
]
"""

  # Response headers
  headers: {
    Content-Type: "application/json"
    X-Total-Count: "2"
    X-Request-Id: "be95bcac-5218-41b6-9adb-f02ff689833c"
  }
  delay_ms: 289 # simulated latency
}

See Also