CodeBattles
Github
RU_v3
RU_v3
  • О системе V3
  • Обзор
    • Интерфейс участника
    • Интерфейс администратора
      • Задачи
      • Чекеры
      • Соревнования
  • Настройка и установка системы
    • Установка
      • Локальная установка
      • Production установка
  • Первое соревнование
    • Создать соревнование
  • Инструкции
    • Соревнование
      • Создание соревнования
      • Редактирование чекеров соревнования
      • Редактирование пользователей соревнования
      • Редактирование задач соревнования
    • Задачи
      • Добавить задачу
      • Изменить задачу
      • Удалить задачу
    • Пользователи
      • Регистрация пользователей
    • Чекеры
      • Создание чекера
      • Изменение чекера
      • Удаление чекера
  • Как работает система
    • Архитектура
    • Безопасность
  • API
    • Введение в API
    • Backend
      • Checkers
      • Competition Problems
      • Users
      • Answer
      • Competitions
      • Ping Pong
      • Problems
      • Auth
      • Checker system API
      • Models
    • Checker API
      • HealthCheck
      • Test
Powered by GitBook
On this page

Was this helpful?

  1. API
  2. Backend

Users

PreviousCompetition ProblemsNextAnswer

Was this helpful?

Endpoints for managing users

Get current user

get

Retrieves current user.

Authorizations
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/users/me HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
  "musername": "text",
  "mpassword": "text",
  "name": "text",
  "roles": [
    "USER"
  ],
  "id": 1,
  "createdAt": "2025-05-24T09:15:32.793Z",
  "updatedAt": "2025-05-24T09:15:32.793Z",
  "username": "text",
  "authorities": [
    {
      "authority": "text"
    }
  ],
  "isAdmin": true,
  "password": "text",
  "enabled": true,
  "accountNonLocked": true,
  "accountNonExpired": true,
  "credentialsNonExpired": true
}
  • GET[ADMIN] Get all users
  • POST[ADMIN] Create user
  • POST[ADMIN] Link user to competition
  • GETGet current user

[ADMIN] Get all users

get

Retrieves a list of all users. Required admin role

Authorizations
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
[
  {
    "id": 1,
    "username": "john_doe"
  }
]

[ADMIN] Create user

post

Create user with provided data. Required admin role.

Authorizations
Body
musernamestring · min: 1Required

Username of the user

Example: john_doe
mpasswordstring · min: 1Required

Password of the user

Example: securepassword123
namestringOptional

Full name of the user

Example: John Doe
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
post
POST /api/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 74

{
  "musername": "john_doe",
  "mpassword": "securepassword123",
  "name": "John Doe"
}
{
  "id": 1,
  "username": "john_doe"
}

[ADMIN] Link user to competition

post

Links a user to a competition. Required admin role.

Authorizations
Body

Request to link a user to a competition

userIdinteger · int64Required

ID of the user

Example: 1
competitionIdinteger · int64Required

ID of the competition

Example: 1001
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
post
POST /api/users/link HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 33

{
  "userId": 1,
  "competitionId": 1001
}
{
  "status": "OK"
}