test-mock-wrangler-api

Mock API of real-estate units for the test assignment. Responses are JSON, no authentication required. The base URL is this Worker's address; all resources live under /api.

GET /api/units

List of units with filtering, sorting and pagination. The total number of records matching the current filter is returned in the X-Total-Count response header (it is not in the body).

Query parameters (all optional)

ParameterTypeDescription
pageinteger, ≥ 1Page number. Defaults to 1.
pageSizeintegerPage size. Defaults to 25, maximum 100.
sortstringField and direction: field:asc / field:desc. Available fields: price, area, floor, rooms, createdAt.
priceMinintegerLower price bound, inclusive (minor units, see the model).
priceMaxintegerUpper price bound, inclusive (minor units).
roomsstringComma-separated values, e.g. rooms=1,2,3 (0 means studio).
statusstringComma-separated statuses, e.g. status=available,reserved.
searchstringCase-insensitive substring search over title.

Different filters are combined with AND. Values inside rooms and status are combined with OR.

Example

GET /api/units?status=available&rooms=1,2&sort=price:asc&page=1&pageSize=25

Response 200:

Headers:
  X-Total-Count: 1287

Body:
{
  "items": [
    {
      "id": "u_000123",
      "title": "Unit 12-04",
      "building": "Building A",
      "area": 48.5,
      "rooms": 2,
      "floor": 7,
      "price": 12500000,
      "status": "available",
      "createdAt": "2025-11-14T10:00:00.000Z"
    }
  ]
}

GET /api/units/:id

A single unit by id. 200 + a Unit object, or 404 { "error": "not_found" }.

GET /api/meta

Reference data for building the filters.

{
  "statuses": ["available", "reserved", "sold"],
  "rooms": [0, 1, 2, 3, 4, 5],
  "priceRange": { "min": 2841000, "max": 71141300 },
  "currency": "RUB",
  "priceMinorUnits": 100
}

Unit model

FieldTypeDescription
idstringStable identifier.
titlestringUnit title (used by search).
buildingstringBuilding.
areanumberArea, m².
roomsintegerNumber of rooms; 0 means studio.
floorintegerFloor.
priceintegerPrice in minor units (see the note).
statusstringUnit status: available, reserved, sold.
createdAtstringCreation date, ISO 8601.
About prices. The price field and the priceMin/priceMax parameters are expressed in the currency's minor units (see priceMinorUnits in /api/meta). For example, 12500000 with priceMinorUnits: 100 equals 125,000 ₽.