Download OpenAPI specification:
Современный API для игры-тамагочи с системой управления стрессом и тревожностью.
API использует JWT Bearer токены для аутентификации.
После успешного логина или регистрации вы получите токен:
Authorization: Bearer YOUR_JWT_TOKEN
Все ответы API имеют единообразную структуру:
{
"success": true,
"message": "Операция выполнена успешно",
"data": {
// Данные ответа
},
"player_state": {
// 🎮 СТАНДАРТИЗИРОВАННЫЙ ОБЪЕКТ ИГРОКА
// Присутствует во ВСЕХ эндпоинтах (кроме auth)
"id": 123,
"level": 5,
"experience": {...},
"energy": {...},
"stress": {...}
// Полное описание см. ниже
}
}
При ошибках валидации:
{
"success": false,
"message": "Ошибки валидации",
"errors": {
"email": ["Введите корректный email"],
"password": ["Пароль слишком короткий"]
}
}
Объект player_state
присутствует во ВСЕХ API ответах (кроме auth). Фронтенд получает полное состояние игрока в каждом запросе:
{
"success": true,
"data": { ... },
"player_state": {
"level": 5,
"energy": { "current": 120, "percentage": 60.0, "status": {"color": "#2196F3"} },
"stress": { "current": 35, "level": {"value": "normal", "color": "#2196F3"} },
"capabilities": { "can_perform_micro_actions": true, "can_start_situations": true }
}
}
id
- Уникальный ID профиля игрока (integer)user_id
- ID пользователя-владельца профиля (integer) level
- Текущий уровень игрока (integer, min: 1)experience
)total
- Общее количество опыта за всё время (integer, min: 0)current_level
- Опыт в пределах текущего уровня, 0-99 (integer)to_next_level
- Сколько опыта нужно до следующего уровня (integer, 1-100)progress_percentage
- Процент прогресса до следующего уровня (float, 0-100)energy
)current
- Текущее количество энергии (integer, 0-200)max
- Максимальное количество энергии (integer, всегда 200)percentage
- Процент от максимальной энергии (float, 0-100)status.level
- Уровень энергии для UI:"critical"
(0-24%) - 🔴 Красный, игрок не может выполнять действия"low"
(25-49%) - 🟠 Оранжевый, ограниченные возможности"medium"
(50-74%) - 🔵 Синий, нормальное состояние"high"
(75-100%) - 🟢 Зеленый, отличное состояниеstatus.label
- Текстовое описание для UI (string)status.color
- HEX цвет для индикаторов (string, например "#2196F3")stress
)current
- Текущий уровень стресса (integer, 0-100)percentage
- Стресс в процентах (float, 0-100)level.value
- Категория стресса для логики:"low"
(0-20) - 🟢 Спокойное состояние, можно браться за сложные задачи"normal"
(21-50) - 🔵 Обычное состояние, всё под контролем"elevated"
(51-80) - 🟠 Повышенная тревожность, нужна релаксация"high"
(81-100) - 🔴 Высокий стресс, срочно нужен отдыхlevel.label
- Русское название уровня стресса (string)level.color
- HEX цвет для UI индикаторов (string)level.recommended_actions
- Массив рекомендаций (array of strings)anxiety
)current
- Текущий уровень тревожности (integer, 0-100)percentage
- Тревожность в процентах (float, 0-100)activity
)last_login
- Время последнего входа (ISO 8601 datetime)consecutive_days
- Количество дней подряд в игре (integer, min: 0)can_claim_daily_reward
- Можно ли получить ежедневную награду (boolean)capabilities
)can_perform_micro_actions
- Может ли выполнять микродействия (boolean)true
если energy >= 10
false
- кнопки микродействий неактивны, показать "Недостаточно энергии"can_start_situations
- Может ли начинать ситуации (boolean)true
если energy >= 20 AND stress <= 80
false
- показать причину (энергия/стресс) и рекомендацииtimestamps
)created_at
- Дата создания профиля (ISO 8601 datetime)updated_at
- Дата последнего обновления (ISO 8601 datetime)energy.status.color
и stress.level.color
для индикаторовcapabilities.*
для активации/деактивации кнопокexperience.progress_percentage
для прогресс-баровstress.level.recommended_actions
для подсказок пользователюenergy.status.level
и stress.level.value
для логики UIPOST /auth/register
Authorization
Создает новый аккаунт пользователя с автоматическим созданием профиля игрока.
Требования к паролю:
name required | string [ 2 .. 255 ] characters ^[a-zA-Zа-яА-ЯёЁ\s\-'\.]+$ Имя пользователя (только буквы, пробелы, дефисы, апострофы) |
email required | string <email> <= 255 characters |
password required | string >= 8 characters ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]... Сложный пароль согласно требованиям |
password_confirmation required | string Подтверждение пароля (должно совпадать с password) |
{- "name": "Иван Иванов",
- "email": "ivan@example.com",
- "password": "MyPass123!",
- "password_confirmation": "MyPass123!"
}
{- "success": true,
- "message": "Пользователь успешно зарегистрирован",
- "data": {
- "user": {
- "id": 1,
- "name": "Иван Иванов",
- "email": "ivan@example.com",
- "is_admin": false,
- "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "player": {
- "id": 1,
- "user_id": 1,
- "level": 5,
- "total_experience": 450,
- "energy": 100,
- "stress": 30,
- "anxiety": 25,
- "last_login": "2025-09-04T06:10:25.000000Z",
- "last_daily_reward": "2025-09-04T00:00:00.000000Z",
- "consecutive_days": 3,
- "personal_info": {
- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}, - "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
- "token_type": "bearer",
- "expires_in": 900
}
}
Аутентификация пользователя по email и паролю
email required | string <email> |
password required | string >= 6 characters |
{- "email": "ivan@example.com",
- "password": "MyPass123!"
}
{- "success": true,
- "message": "Пользователь успешно зарегистрирован",
- "data": {
- "user": {
- "id": 1,
- "name": "Иван Иванов",
- "email": "ivan@example.com",
- "is_admin": false,
- "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "player": {
- "id": 1,
- "user_id": 1,
- "level": 5,
- "total_experience": 450,
- "energy": 100,
- "stress": 30,
- "anxiety": 25,
- "last_login": "2025-09-04T06:10:25.000000Z",
- "last_daily_reward": "2025-09-04T00:00:00.000000Z",
- "consecutive_days": 3,
- "personal_info": {
- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}, - "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
- "token_type": "bearer",
- "expires_in": 900
}
}
Получение нового JWT токена без повторной авторизации
{- "success": true,
- "message": "Токен успешно обновлен",
- "data": {
- "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
- "token_type": "bearer",
- "expires_in": 900
}
}
Отправка инструкций по сбросу пароля на email
email required | string <email> |
{- "email": "ivan@example.com"
}
{- "success": true,
- "message": "Инструкции по сбросу пароля отправлены на email",
- "data": { }
}
Установка нового пароля с использованием токена сброса
email required | string <email> |
token required | string |
password required | string >= 8 characters ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&]... |
password_confirmation required | string |
{- "email": "ivan@example.com",
- "token": "reset_token_here",
- "password": "NewPass123!",
- "password_confirmation": "NewPass123!"
}
{- "success": true,
- "message": "Пароль успешно изменен",
- "data": { }
}
Верификация email адреса пользователя
token required | string |
{- "token": "verification_token_here"
}
{- "success": true,
- "message": "Email успешно подтвержден",
- "data": { }
}
Возвращает текущий профиль игрока с актуальной статистикой
{- "success": true,
- "message": "Профиль игрока успешно получен",
- "data": {
- "id": 1,
- "user_id": 1,
- "level": 5,
- "total_experience": 450,
- "energy": 100,
- "stress": 30,
- "anxiety": 25,
- "last_login": "2025-09-04T06:10:25.000000Z",
- "last_daily_reward": "2025-09-04T00:00:00.000000Z",
- "consecutive_days": 3,
- "personal_info": {
- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}, - "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Обновление данных профиля игрока (стресс, тревожность)
stress | integer [ 0 .. 100 ] Уровень стресса |
anxiety | integer [ 0 .. 100 ] Уровень тревожности |
{- "stress": 45,
- "anxiety": 30
}
{- "success": true,
- "message": "Профиль успешно обновлен",
- "data": {
- "id": 1,
- "user_id": 1,
- "level": 5,
- "total_experience": 450,
- "energy": 100,
- "stress": 30,
- "anxiety": 25,
- "last_login": "2025-09-04T06:10:25.000000Z",
- "last_daily_reward": "2025-09-04T00:00:00.000000Z",
- "consecutive_days": 3,
- "personal_info": {
- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}, - "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "updated_fields": [
- "stress",
- "anxiety"
], - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Обновление персональных данных профиля игрока (любимая песня, фильм, книга, блюдо, имя лучшего друга)
favorite_song | string <= 255 characters Любимая песня |
favorite_movie | string <= 255 characters Любимый фильм |
favorite_book | string <= 255 characters Любимая книга |
favorite_dish | string <= 255 characters Любимое блюдо |
best_friend_name | string <= 255 characters Имя лучшего друга |
{- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}
{- "success": true,
- "message": "Персональная информация успешно обновлена",
- "data": {
- "id": 1,
- "user_id": 1,
- "level": 5,
- "total_experience": 450,
- "energy": 100,
- "stress": 30,
- "anxiety": 25,
- "last_login": "2025-09-04T06:10:25.000000Z",
- "last_daily_reward": "2025-09-04T00:00:00.000000Z",
- "consecutive_days": 3,
- "personal_info": {
- "favorite_song": "Bohemian Rhapsody",
- "favorite_movie": "Inception",
- "favorite_book": "1984",
- "favorite_dish": "Пицца",
- "best_friend_name": "Александр"
}, - "created_at": "2025-09-04T06:10:25.000000Z",
- "updated_at": "2025-09-04T06:10:25.000000Z"
}, - "updated_fields": [
- "favorite_song",
- "favorite_movie"
]
}
{- "success": true,
- "data": {
- "total_situations_completed": 45,
- "total_micro_actions_performed": 120,
- "average_stress_level": 35.5,
- "time_played_hours": 24,
- "achievements": [
- {
- "id": 0,
- "name": "string",
- "description": "string",
- "unlocked_at": "2019-08-24T14:15:22Z"
}
]
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Получение ежедневной награды (опыт, энергия). Доступно раз в день.
{- "success": true,
- "message": "Ежедневная награда получена",
- "data": {
- "experience_gained": 50,
- "energy_gained": 20,
- "consecutive_days": 5
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Добавление опыта игроку (для внутренних нужд)
amount required | integer [ 1 .. 1000 ] Количество опыта для добавления |
reason | string Причина добавления опыта |
{- "amount": 25,
- "reason": "Завершение ситуации"
}
{- "success": true,
- "data": {
- "experience_added": 25,
- "level_up": false,
- "old_level": 5,
- "new_level": 5
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Изменение уровня энергии игрока
amount required | integer [ -200 .. 200 ] Изменение энергии (может быть отрицательным) |
{- "amount": -20
}
{- "success": true,
- "data": {
- "old_energy": 100,
- "new_energy": 80,
- "change": -20
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Изменение уровня стресса игрока
amount required | integer [ -100 .. 100 ] Изменение стресса (может быть отрицательным) |
{- "amount": -10
}
{- "success": true,
- "data": {
- "old_stress": 40,
- "new_stress": 30,
- "change": -10
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Получение списка ситуаций, доступных для текущего уровня игрока
category | string Enum: "work" "personal" "health" "social" "education" Фильтр по категории ситуации |
difficulty | string Enum: "easy" "medium" "hard" Фильтр по сложности |
page | integer >= 1 Default: 1 Номер страницы для пагинации |
{- "success": true,
- "data": {
- "situations": [
- {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
], - "pagination": {
- "current_page": 1,
- "total_pages": 5,
- "total": 45
}, - "player_info": {
- "current_stress": 35,
- "current_energy": 120,
- "level": 5
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
}
Получение случайной ситуации, подходящей по уровню и категории предпочтений
{- "success": true,
- "data": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
}
Получение случайной ситуации из персонализированных рекомендаций.
Логика выбора:
Отличие от /random
: персонализация vs полная случайность
{- "success": true,
- "message": "Случайная рекомендованная ситуация успешно получена",
- "data": {
- "situation": {
- "id": 15,
- "title": "Медитация в парке",
- "description": "Прекрасный солнечный день. Вы находите тихое место в парке...",
- "category": "health",
- "difficulty_level": 1,
- "min_level_required": 1,
- "stress_impact": -10,
- "experience_reward": 15,
- "is_active": true,
- "position": "phone",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}, - "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
], - "player_info": {
- "current_stress": 85,
- "current_energy": 120,
- "level": 1
}, - "is_recommended": true,
- "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
}
Получение информации о всех текущих активных ситуациях игрока.
Активная ситуация - это ситуация, которая была начата (POST /situations/{id}/start), но еще не завершена (POST /situations/{id}/complete).
Возможные состояния:
Используется для восстановления состояния игры после перезапуска приложения.
{- "success": true,
- "message": "Активные ситуации успешно получены (найдено: 2)",
- "data": {
- "situations": [
- {
- "player_situation_id": 123,
- "situation": {
- "id": 7,
- "title": "Горящий дедлайн на работе",
- "description": "Ваш руководитель просит срочно закончить проект до конца дня...",
- "category": "work",
- "difficulty_level": 2,
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 20,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}, - "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
], - "started_at": "2025-09-24T14:30:00Z"
}
], - "count": 2,
- "player_info": {
- "current_stress": 45,
- "current_energy": 120,
- "level": 2
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}, - "cooldown_info": {
- "on_cooldown": false,
- "cooldown_ends_at": null,
- "can_start_new": true
}
}
}
Получение истории ситуаций, пройденных игроком
page | integer >= 1 Default: 1 Номер страницы для пагинации |
limit | integer [ 1 .. 50 ] Default: 20 Количество записей на страницу |
{- "success": true,
- "data": {
- "history": [
- {
- "id": 1,
- "situation": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}, - "option_chosen": {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}, - "completed_at": "2025-09-04T10:15:30Z",
- "results": {
- "experience_gained": 25,
- "stress_change": -10
}
}
], - "pagination": {
- "current_page": 1,
- "total_pages": 3,
- "total": 45
}
}
}
Получение ситуаций, рекомендованных для текущего состояния игрока
{- "success": true,
- "data": {
- "recommended_situations": [
- {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
], - "recommendation_reason": "Поможет снизить текущий уровень стресса",
- "match_score": 0.85
}
]
}
}
Получение подробной информации о конкретной ситуации
id required | integer Example: 1 ID ситуации |
{- "success": true,
- "data": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
}
Начало ситуации с применением базового стресса (stress_impact). После инициации ситуацию можно завершить выбором опции.
id required | integer Example: 1 ID ситуации |
{- "success": true,
- "message": "Ситуация успешно начата!",
- "data": {
- "situation": {
- "id": 1,
- "title": "Горящий дедлайн на работе",
- "description": "Ваш руководитель просит срочно закончить проект...",
- "category": "work",
- "stress_impact": 15,
- "position": "phone"
}, - "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
], - "player_changes": {
- "old_stress": 30,
- "new_stress": 45,
- "stress_change": 15,
- "current_energy": 80,
- "current_level": 5
}, - "player_situation_id": 123
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Выбор варианта решения ситуации и получение результатов
id required | integer Example: 1 ID ситуации |
option_id required | integer ID выбранного варианта решения |
{- "option_id": 2
}
{- "success": true,
- "message": "Ситуация успешно завершена",
- "data": {
- "experience_gained": 25,
- "stress_change": -10,
- "energy_spent": 20,
- "level_up": false,
- "new_stats": {
- "level": 5,
- "experience": 475,
- "energy": 80,
- "stress": 20
}
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
Получение списка микродействий для восстановления энергии и получения опыта
category | string Enum: "relaxation" "exercise" "creativity" "social" Example: category=relaxation Фильтр по категории микродействия |
{- "success": true,
- "message": "Список микродействий успешно получен",
- "data": {
- "micro_actions": [
- {
- "id": 1,
- "name": "Глубокое дыхание 4-7-8",
- "description": "Техника дыхания: вдох на 4 счета, задержка на 7, выдох на 8. Повторить 4 раза.",
- "category": {
- "value": "relaxation",
- "label": "Релаксация",
- "icon": "🧘",
- "color": "#9C27B0"
}, - "energy_reward": 15,
- "experience_reward": 8,
- "cooldown_minutes": 30,
- "unlock_level": 1,
- "position": "phone",
- "can_perform": true,
- "cooldown_ends_at": "2025-10-02T10:30:00.000000Z"
}
], - "player_info": {
- "current_energy": 85,
- "level": 3
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}, - "stats": {
- "total_performed": 89,
- "today_performed": 3
}
}
}
Получение списка микродействий, рекомендованных на основе текущего состояния игрока (уровень энергии, стресс, уровень)
{- "success": true,
- "message": "Рекомендованные микродействия успешно получены",
- "data": {
- "recommendations": [
- {
- "id": 1,
- "name": "Глубокое дыхание 4-7-8",
- "description": "Техника дыхания: вдох на 4 счета, задержка на 7, выдох на 8.",
- "category": {
- "value": "relaxation",
- "label": "Релаксация",
- "icon": "🧘"
}, - "energy_reward": 15,
- "experience_reward": 8,
- "can_perform": true
}
], - "based_on": {
- "energy_level": 85,
- "stress_level": 45,
- "player_level": 3
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
}
Получение одного случайного микродействия из рекомендаций, подходящих для текущего состояния игрока
{- "success": true,
- "message": "Случайное рекомендованное микродействие получено",
- "data": {
- "micro_action": {
- "id": 1,
- "name": "Глубокое дыхание 4-7-8",
- "description": "Техника дыхания: вдох на 4 счета, задержка на 7, выдох на 8. Повторить 4 раза.",
- "category": {
- "value": "relaxation",
- "label": "Релаксация",
- "icon": "🧘",
- "color": "#9C27B0"
}, - "energy_reward": 15,
- "experience_reward": 8,
- "cooldown_minutes": 30,
- "unlock_level": 1,
- "position": "phone",
- "can_perform": true,
- "cooldown_ends_at": "2025-10-02T10:30:00.000000Z"
}, - "based_on": {
- "energy_level": 85,
- "stress_level": 45,
- "player_level": 3
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
}
Получение истории микродействий, выполненных игроком
limit | integer [ 1 .. 100 ] Default: 20 Количество записей для возврата |
{- "success": true,
- "message": "История микродействий успешно получена",
- "data": {
- "history": [
- {
- "micro_action_name": "Глубокое дыхание 4-7-8",
- "category": {
- "value": "relaxation",
- "label": "Релаксация",
- "icon": "🧘"
}, - "completed_at": "2025-10-02T08:15:00.000000Z",
- "energy_gained": 15,
- "experience_gained": 8
}
], - "stats": {
- "total_performed": 89,
- "today_performed": 3
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}
}
}
Выполнение выбранного микродействия для получения энергии и опыта
id required | integer Example: 1 ID микродействия |
{- "success": true,
- "message": "Микродействие успешно выполнено!",
- "data": {
- "micro_action": "Глубокое дыхание 4-7-8",
- "rewards": {
- "energy_gained": 15,
- "experience_gained": 8
}, - "player_changes": {
- "old_energy": 70,
- "new_energy": 85,
- "old_level": 3,
- "new_level": 3,
- "level_up": false
}, - "player_state": {
- "id": 123,
- "user_id": 456,
- "level": 5,
- "experience": {
- "total": 450,
- "current_level": 50,
- "to_next_level": 50,
- "progress_percentage": 50
}, - "energy": {
- "current": 120,
- "max": 200,
- "percentage": 60,
- "status": {
- "level": "medium",
- "label": "Нормальный уровень энергии",
- "color": "#2196F3"
}
}, - "stress": {
- "current": 35,
- "percentage": 35,
- "level": {
- "value": "normal",
- "label": "Нормальный",
- "color": "#2196F3",
- "recommended_actions": [
- "Поддерживайте текущий ритм",
- "Не забывайте о перерывах"
]
}
}, - "anxiety": {
- "current": 25,
- "percentage": 25
}, - "activity": {
- "last_login": "2025-09-28T10:30:00Z",
- "consecutive_days": 7,
- "can_claim_daily_reward": true
}, - "capabilities": {
- "can_perform_micro_actions": true,
- "can_start_situations": true
}, - "timestamps": {
- "created_at": "2025-09-01T12:00:00Z",
- "updated_at": "2025-09-28T10:30:00Z"
}
}, - "cooldown_until": "2025-10-02T09:45:00.000000Z"
}
}
Получение всех конфигурационных параметров игры (только для администраторов)
{- "success": true,
- "data": {
- "configs": [
- {
- "id": 1,
- "key": "daily_reward_base_experience",
- "value": "50",
- "description": "Базовое количество опыта за ежедневную награду",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
]
}
}
Обновление значения конфигурационного параметра игры
key required | string Example: daily_reward_base_experience Ключ конфигурации |
value required | string Новое значение конфигурации |
description | string Описание конфигурации (опционально) |
{- "value": "75",
- "description": "Базовое количество опыта за ежедневную награду"
}
{- "success": true,
- "message": "Конфигурация успешно обновлена",
- "data": {
- "id": 1,
- "key": "daily_reward_base_experience",
- "value": "50",
- "description": "Базовое количество опыта за ежедневную награду",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z"
}
}
Получение списка всех ситуаций для администрирования
page | integer >= 1 Default: 1 Номер страницы |
per_page | integer [ 1 .. 100 ] Default: 20 Количество записей на страницу |
category | string Enum: "work" "personal" "health" "social" "education" Фильтр по категории |
active | boolean Фильтр по активности |
{- "success": true,
- "data": {
- "situations": [
- {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
], - "pagination": {
- "current_page": 1,
- "per_page": 20,
- "total": 150,
- "total_pages": 8
}
}
}
Создание новой игровой ситуации с вариантами решений
title required | string <= 255 characters |
description required | string |
category required | string Enum: "work" "personal" "health" "social" "education" |
difficulty_level required | string Enum: "easy" "medium" "hard" |
min_level_required | integer >= 1 Default: 1 |
stress_impact | integer [ -50 .. 50 ] |
experience_reward | integer >= 0 |
is_active | boolean Default: true |
position | string Default: "desktop" Enum: "phone" "tv" "desktop" "tablet" "smartwatch" "notification" Место отображения ситуации |
required | Array of objects [ 2 .. 5 ] items |
{- "title": "Конфликт с коллегой",
- "description": "Ваш коллега постоянно критикует вашу работу на совещаниях",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 3,
- "stress_impact": 20,
- "experience_reward": 30,
- "is_active": true,
- "position": "desktop",
- "options": [
- {
- "text": "Открыто поговорить с коллегой о ситуации",
- "stress_change": -15,
- "experience_reward": 20,
- "energy_cost": 15,
- "min_level_required": 1
}, - {
- "text": "Открыто поговорить с коллегой о ситуации",
- "stress_change": -15,
- "experience_reward": 20,
- "energy_cost": 15,
- "min_level_required": 1
}
]
}
{- "success": true,
- "message": "Ситуация успешно создана",
- "data": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
}
Обновление существующей игровой ситуации
id required | integer Example: 1 ID ситуации |
title | string <= 255 characters |
description | string |
category | string Enum: "work" "personal" "health" "social" "education" |
difficulty_level | string Enum: "easy" "medium" "hard" |
min_level_required | integer >= 1 |
stress_impact | integer [ -50 .. 50 ] |
experience_reward | integer >= 0 |
is_active | boolean |
Array of objects |
{- "title": "Конфликт с коллегой (обновлено)",
- "description": "Ваш коллега постоянно критикует вашу работу",
- "category": "work",
- "difficulty_level": "hard",
- "min_level_required": 5,
- "stress_impact": 25,
- "experience_reward": 40,
- "is_active": true,
- "options": [
- {
- "id": 1,
- "text": "Обсудить проблему с руководителем",
- "stress_change": -20,
- "experience_reward": 25,
- "energy_cost": 20
}
]
}
{- "success": true,
- "message": "Ситуация успешно обновлена",
- "data": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}
}
Получение ключевых метрик и статистики для дашборда
period | string Default: "month" Enum: "today" "week" "month" "quarter" "year" Период для анализа |
date_from | string <date> Example: date_from=2025-08-01 Начальная дата (ISO 8601) |
date_to | string <date> Example: date_to=2025-09-01 Конечная дата (ISO 8601) |
{- "success": true,
- "data": {
- "overview": {
- "total_users": 1234,
- "active_users": 456,
- "total_situations_completed": 5678,
- "total_micro_actions_performed": 12345,
- "average_stress_level": 42.5,
- "average_session_duration": 1800
}, - "trends": {
- "user_growth": 15.2,
- "engagement_rate": 78.5,
- "stress_reduction": -12.3
}, - "top_categories": [
- {
- "category": "work",
- "count": 234,
- "percentage": 35.6
}
], - "recent_activity": [
- {
- "event_type": "user.registration",
- "count": 15,
- "timestamp": "2025-09-04T12:00:00Z"
}
]
}
}
Подробная аналитика поведенческих паттернов игроков
segment | string Default: "all" Enum: "all" "new" "returning" "active" "inactive" Сегмент пользователей для анализа |
period | string Default: "month" Enum: "week" "month" "quarter" Период для анализа |
{- "success": true,
- "data": {
- "user_segments": {
- "new_users": 123,
- "returning_users": 456,
- "churned_users": 78
}, - "engagement_patterns": {
- "average_sessions_per_user": 4.2,
- "average_session_duration": 1200,
- "most_active_hours": [
- {
- "hour": 20,
- "activity_count": 156
}
], - "most_active_days": [
- {
- "day": "monday",
- "activity_count": 234
}
]
}, - "feature_usage": {
- "situations_vs_micro_actions": {
- "situations_percentage": 65.3,
- "micro_actions_percentage": 34.7
}, - "preferred_categories": [
- {
- "category": "work",
- "usage_percentage": 45.2
}
]
}, - "stress_patterns": {
- "average_initial_stress": 65.2,
- "average_final_stress": 42.8,
- "improvement_rate": 85.6
}
}
}
Анализ популярности и эффективности игровых ситуаций
category | string Enum: "work" "personal" "health" "social" "education" Фильтр по категории ситуаций |
period | string Default: "month" Enum: "week" "month" "quarter" Период для анализа |
sort_by | string Default: "popularity" Enum: "popularity" "effectiveness" "completion_rate" Сортировка результатов |
{- "success": true,
- "data": {
- "overview": {
- "total_situations": 45,
- "active_situations": 42,
- "total_completions": 1234,
- "average_completion_rate": 73.5
}, - "most_popular": [
- {
- "situation": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}, - "completion_count": 156,
- "completion_rate": 82.3,
- "average_stress_change": -15.2
}
], - "most_effective": [
- {
- "situation": {
- "id": 1,
- "title": "Сложная презентация на работе",
- "description": "Завтра у вас важная презентация перед руководством",
- "category": "work",
- "difficulty_level": "medium",
- "min_level_required": 1,
- "stress_impact": 15,
- "experience_reward": 25,
- "is_active": true,
- "position": "desktop",
- "created_at": "2019-08-24T14:15:22Z",
- "updated_at": "2019-08-24T14:15:22Z",
- "options": [
- {
- "id": 1,
- "situation_id": 1,
- "text": "Тщательно подготовиться и порепетировать",
- "stress_change": -10,
- "experience_reward": 15,
- "energy_cost": 20,
- "min_level_required": 1,
- "order": 1
}
]
}, - "effectiveness_score": 4.2,
- "stress_reduction": 18.5
}
], - "category_breakdown": [
- {
- "category": "work",
- "total_situations": 15,
- "completion_count": 450,
- "average_effectiveness": 3.8
}
], - "option_choices": [
- {
- "situation_title": "Сложная презентация на работе",
- "options": [
- {
- "option_text": "Тщательно подготовиться",
- "choice_percentage": 45.6,
- "success_rate": 78.2
}
]
}
]
}
}
Анализ общей активности пользователей и системы
granularity | string Default: "day" Enum: "hour" "day" "week" "month" Детализация временных данных |
period | string Default: "month" Enum: "week" "month" "quarter" "year" Период для анализа |
{- "success": true,
- "data": {
- "timeline": [
- {
- "period": "2025-09-04",
- "registrations": 15,
- "logins": 127,
- "situations_completed": 89,
- "micro_actions_performed": 234,
- "active_users": 78
}
], - "event_types": [
- {
- "event_type": "situation.completed",
- "count": 1234,
- "percentage": 23.4
}
], - "peak_hours": [
- {
- "hour": 20,
- "activity_level": "high",
- "event_count": 234
}
], - "retention_metrics": {
- "daily_retention": 45.2,
- "weekly_retention": 28.7,
- "monthly_retention": 15.3
}
}
}