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

Answer

PreviousUsersNextCompetitions

Was this helpful?

Endpoints for answers

Get answer by ID

get

Retrieves answer details by its ID. Requires access to the answer.

Authorizations
Path parameters
idinteger · int64Required
Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/answers/{id} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
  "id": 1,
  "user": {
    "id": 1,
    "username": "john_doe"
  },
  "status": "IN_PROGRESS",
  "score": 100,
  "code": "print('Hello, World!')",
  "result": "Success",
  "checker": {
    "id": 1,
    "displayName": "Default Python3 Checker",
    "languageHighlightName": "python"
  },
  "createdAt": "2023-01-01T12:00:00Z",
  "competitionsProblems": {
    "id": 1,
    "priority": 12,
    "problem": {
      "id": 1,
      "name": "Sum of Two Numbers",
      "description": "Calculate the sum of two integers.",
      "inData": 1,
      "outData": 3,
      "examples": "Input: 1 2, Output: 3",
      "public": true
    },
    "slug": "text"
  }
}

[ADMIN] Get the last answer by problem and user ID

get

Retrieves the most recent answer submitted by a specific user for a specific competition problem. Required admin role.

Authorizations
Query parameters
compProblemIdinteger · int64Required

The ID of CompetitionProblem id

userIdinteger · int64Required

The ID of the user

Responses
200
OK
*/*
401
Unauthorized
*/*
403
Forbidden
*/*
500
Internal Server Error
*/*
get
GET /api/answers/last HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
  "id": 1,
  "user": {
    "id": 1,
    "username": "john_doe"
  },
  "status": "IN_PROGRESS",
  "score": 100,
  "code": "print('Hello, World!')",
  "result": "Success",
  "checker": {
    "id": 1,
    "displayName": "Default Python3 Checker",
    "languageHighlightName": "python"
  },
  "createdAt": "2023-01-01T12:00:00Z",
  "competitionsProblems": {
    "id": 1,
    "priority": 12,
    "problem": {
      "id": 1,
      "name": "Sum of Two Numbers",
      "description": "Calculate the sum of two integers.",
      "inData": 1,
      "outData": 3,
      "examples": "Input: 1 2, Output: 3",
      "public": true
    },
    "slug": "text"
  }
}
  • GETGet answer by ID
  • GET[ADMIN] Get the last answer by problem and user ID