API Documentation

1. Главная страница (Homepage)

Method: GET

Endpoint: /api/home

Params: No parameters required for this endpoint.

This endpoint returns the user profile data, training information, and rating details.

{
    "user": {
        "id": 1,
        "name": "Agnieszka Shiklina",
        "avatar": "url_to_avatar"
    },
    "space_coins": 1449,
    "training_count": 124,
    "trainer": {
        "name": "Мария Ивановна",
        "contact": "+48746099769"
    },
    "rating": [
        { "name": "Anna Kowalska", "place": 1 },
        { "name": "Filip Zając", "place": 2 }
    ]
}
            

2. Олимпиады (Olympiads)

Method: GET

Endpoint: /api/olympiads

Params:

This endpoint returns a list of available olympiads with details such as category, level, and price.

[
    {
        "id": 1,
        "title": "Украинская Национальная Олимпиада",
        "category": "Математика",
        "level": "Средний",
        "date": "2025-04-26",
        "price": 500,
        "type": "Украинские",
        "currency": "₴"
    },
    {
        "id": 2,
        "title": "International Competition",
        "category": "Физика",
        "level": "Сложный",
        "date": "2025-07-17",
        "price": 1700,
        "type": "Международные",
        "currency": "₴"
    }
]
            

3. Регистрация (Registration)

Method: POST

Endpoint: /api/auth/register

Params:

This endpoint registers a new user in the system.

**Success:**
{
    "message": "Регистрация успешна",
    "user_id": 5
}

**Errors:**
{
    "error": "Некорректный email",
    "code": 400
}
            

4. Рейтинг (Ranking)

Method: GET

Endpoint: /api/ranking

Params: No parameters required for this endpoint.

This endpoint returns a list of users who are part of the ranking, including their rank, name, age group, and points.

[
    {
        "place": 1,
        "name": "Łukasz Dudek",
        "level": "Intermediate",
        "age": "13-15",
        "points": 9976
    },
    {
        "place": 2,
        "name": "Anna Kamińska",
        "level": "Intermediate",
        "age": "13-15",
        "points": 9950
    },
    {
        "place": 3,
        "name": "Tomasz Zieliński",
        "level": "Intermediate",
        "age": "13-15",
        "points": 9877
    }
]