Skip to content

Latest commit

 

History

History
70 lines (47 loc) · 1.7 KB

File metadata and controls

70 lines (47 loc) · 1.7 KB

MockAPI

Fixture-backed Clash of Clans mock API for local development, demos, and integration testing. It mirrors common Clash of Clans endpoints with deterministic responses and serves interactive docs from the app itself.

Public instance: api.clashapi.dev

Features

  • FastAPI app with interactive Scalar docs at /
  • OpenAPI schema at /openapi.json
  • Stable JSON fixtures for clan, player, league, location, label, and gold pass endpoints
  • Variant-based mock responses using #2PP and additional trailing Ps where supported
  • Pagination support on list endpoints via limit, after, and before

Quick Start

Requirements:

  • Python 3.13.7+
  • uv

Install dependencies and run the API:

uv sync
uv run python main.py

The app starts on http://localhost:3000.

Usage

Interactive docs:

Example requests:

curl https://api.clashapi.dev/players/%232PP
curl "https://api.clashapi.dev/clans?name=mock&limit=5"
curl https://api.clashapi.dev/openapi.json

Mock tags are deterministic:

  • #2PP returns the primary fixture
  • Appending Ps selects alternate variants when an endpoint supports them
  • Tags outside the #2PP... pattern return a mock bad request response

Example:

curl https://api.clashapi.dev/players/%232PP
curl https://api.clashapi.dev/players/%232PPP

Supported Areas

  • clans
  • players
  • leagues
  • locations and rankings
  • labels
  • goldpass

License

Apache 2.0. See LICENSE.