Competitions
Endpoints for managing competitions
Retrieves competition details by its ID. Requires access to the competition.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId} HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "id": 1,
  "checkers": [
    {
      "id": 1,
      "displayName": "Default Python3 Checker",
      "languageHighlightName": "python"
    }
  ],
  "name": "Code Battles 2023",
  "description": "A competitive coding event",
  "startedAt": "2023-01-01T10:00:00",
  "endedAt": "2023-01-01T18:00:00",
  "public": true,
  "showInput": true,
  "showOutput": true,
  "showRating": true
}Name of the competition
Code Battles 2023Description of the competition
A competitive coding eventStart time of the competition
2023-01-01T10:00:00End time of the competition
2023-01-01T18:00:00If public everyone can join into competition
trueOK
Unauthorized
Forbidden
Conflict
Internal Server Error
PUT /api/competitions/{compId} HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 204
{
  "name": "Code Battles 2023",
  "description": "A competitive coding event",
  "startedAt": "2023-01-01T10:00:00",
  "endedAt": "2023-01-01T18:00:00",
  "public": true,
  "showInput": true,
  "showOutput": true,
  "showRating": true
}{
  "id": 1,
  "checkers": [
    {
      "id": 1,
      "displayName": "Default Python3 Checker",
      "languageHighlightName": "python"
    }
  ],
  "name": "Code Battles 2023",
  "description": "A competitive coding event",
  "startedAt": "2023-01-01T10:00:00",
  "endedAt": "2023-01-01T18:00:00",
  "public": true,
  "showInput": true,
  "showOutput": true,
  "showRating": true
}Retrieves the list of users participating in a specific competition. Required admin role.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId}/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "id": 1,
    "username": "john_doe"
  }
]Updates the list of users participating in a specific competition. Required admin role.
Request to edit users
Set of user IDs to be edited
1,2,3Accepted
No content
Unauthorized
Forbidden
Conflict
Internal Server Error
PUT /api/competitions/{compId}/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 20
{
  "usersIds": "1,2,3"
}No content
Updates the list of checkers for a specific competition. Required admin role.
Request to edit users
Set of user IDs to be edited
1,2,3Accepted
No content
Unauthorized
Forbidden
Conflict
Internal Server Error
PUT /api/competitions/{compId}/checkers HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 20
{
  "usersIds": "1,2,3"
}No content
Retrieves a list of all competitions. Required admin role.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "id": 1,
    "checkers": [
      {
        "id": 1,
        "displayName": "Default Python3 Checker",
        "languageHighlightName": "python"
      }
    ],
    "name": "Code Battles 2023",
    "description": "A competitive coding event",
    "startedAt": "2023-01-01T10:00:00",
    "endedAt": "2023-01-01T18:00:00",
    "public": true,
    "showInput": true,
    "showOutput": true,
    "showRating": true
  }
]Creates a new competition object. Required admin role.
Name of the competition
Code Battles 2023Description of the competition
A competitive coding eventStart time of the competition
2023-01-01T10:00:00End time of the competition
2023-01-01T18:00:00OK
Unauthorized
Forbidden
Conflict
Internal Server Error
POST /api/competitions HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 137
{
  "name": "Code Battles 2023",
  "description": "A competitive coding event",
  "startedAt": "2023-01-01T10:00:00",
  "endedAt": "2023-01-01T18:00:00"
}{
  "id": 1,
  "checkers": [
    {
      "id": 1,
      "displayName": "Default Python3 Checker",
      "languageHighlightName": "python"
    }
  ],
  "name": "Code Battles 2023",
  "description": "A competitive coding event",
  "startedAt": "2023-01-01T10:00:00",
  "endedAt": "2023-01-01T18:00:00",
  "public": true,
  "showInput": true,
  "showOutput": true,
  "showRating": true
}Allows a user to submit an answer for a specific competition problem.
Request to send an answer
ID of the checker
1Source code submitted as the answer
print(input())ID of the answer
1001OK
Unauthorized
Forbidden
Conflict
Internal Server Error
POST /api/competitions/{compId}/send HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 46
{
  "checker": 1,
  "src": "print(input())",
  "id": 1001
}textEvery user can join to public competition.
OK
No content
Unauthorized
Forbidden
Conflict
Internal Server Error
POST /api/competitions/{compId}/publicJoin HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
No content
Retrieves all answers submitted by the authenticated user for a specific competition.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId}/sends HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
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"
    }
  }
]Retrieves all problems associated with a specific competition.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId}/problems HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "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"
  }
]Retrieves a specific problem by its ID within a competition.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId}/problems/{id} HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "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"
}Retrieves the leaderboard for a specific competition.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/{compId}/leaderboard HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "score": [
    {
      "userId": 1,
      "userX": "text",
      "score": 1,
      "time": "2025-10-30T18:26:59.930Z"
    }
  ],
  "data": {
    "ANY_ADDITIONAL_PROPERTY": [
      {
        "userId": 1,
        "competitionproblemId": 1,
        "maxScore": 1
      }
    ]
  }
}Retrieves a list of public competitions.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/public HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "id": 1,
    "checkers": [
      {
        "id": 1,
        "displayName": "Default Python3 Checker",
        "languageHighlightName": "python"
      }
    ],
    "name": "Code Battles 2023",
    "description": "A competitive coding event",
    "startedAt": "2023-01-01T10:00:00",
    "endedAt": "2023-01-01T18:00:00",
    "public": true,
    "showInput": true,
    "showOutput": true,
    "showRating": true
  }
]Retrieves all competitions accessible to the authenticated user.
OK
Unauthorized
Forbidden
Conflict
Internal Server Error
GET /api/competitions/me HTTP/1.1
Host: localhost:8080
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
[
  {
    "id": 1,
    "checkers": [
      {
        "id": 1,
        "displayName": "Default Python3 Checker",
        "languageHighlightName": "python"
      }
    ],
    "name": "Code Battles 2023",
    "description": "A competitive coding event",
    "startedAt": "2023-01-01T10:00:00",
    "endedAt": "2023-01-01T18:00:00",
    "public": true,
    "showInput": true,
    "showOutput": true,
    "showRating": true
  }
]Was this helpful?
