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.
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).
| Parameter | Type | Description |
|---|---|---|
page | integer, ≥ 1 | Page number. Defaults to 1. |
pageSize | integer | Page size. Defaults to 25, maximum 100. |
sort | string | Field and direction: field:asc / field:desc. Available fields: price, area, floor, rooms, createdAt. |
priceMin | integer | Lower price bound, inclusive (minor units, see the model). |
priceMax | integer | Upper price bound, inclusive (minor units). |
rooms | string | Comma-separated values, e.g. rooms=1,2,3 (0 means studio). |
status | string | Comma-separated statuses, e.g. status=available,reserved. |
search | string | Case-insensitive substring search over title. |
Different filters are combined with AND. Values inside rooms and
status are combined with OR.
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"
}
]
}
A single unit by id. 200 + a Unit object, or
404 { "error": "not_found" }.
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| Field | Type | Description |
|---|---|---|
id | string | Stable identifier. |
title | string | Unit title (used by search). |
building | string | Building. |
area | number | Area, m². |
rooms | integer | Number of rooms; 0 means studio. |
floor | integer | Floor. |
price | integer | Price in minor units (see the note). |
status | string | Unit status: available, reserved, sold. |
createdAt | string | Creation date, ISO 8601. |
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 ₽.