Competitions

Endpoints for managing competitions

Get competition by ID

get

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

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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
}
put
Authorizations
Path parameters
compIdinteger · int64Required
Body
namestringRequired

Name of the competition

Example: Code Battles 2023
descriptionstringRequired

Description of the competition

Example: A competitive coding event
startedAtstring · date-timeOptional

Start time of the competition

Example: 2023-01-01T10:00:00
endedAtstring · date-timeOptional

End time of the competition

Example: 2023-01-01T18:00:00
publicbooleanRequired

If public everyone can join into competition

Example: true
showInputbooleanRequired
showOutputbooleanRequired
showRatingbooleanRequired
Responses
200
OK
*/*
put
PUT /api/competitions/{compId} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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
}

[ADMIN] Get competition users

get

Retrieves the list of users participating in a specific competition. Required admin role.

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId}/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
[
  {
    "id": 1,
    "username": "john_doe"
  }
]

[ADMIN] Edit competition users

put

Updates the list of users participating in a specific competition. Required admin role.

Authorizations
Path parameters
compIdinteger · int64Required
Body

Request to edit users

usersIdsinteger · int64[]Required

Set of user IDs to be edited

Example: 1,2,3
Responses
202
Accepted
put
PUT /api/competitions/{compId}/users HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 20

{
  "usersIds": "1,2,3"
}

No content

[ADMIN] Edit competition checkers

put

Updates the list of checkers for a specific competition. Required admin role.

Authorizations
Path parameters
compIdinteger · int64Required
Body

Request to edit users

usersIdsinteger · int64[]Required

Set of user IDs to be edited

Example: 1,2,3
Responses
202
Accepted
put
PUT /api/competitions/{compId}/checkers HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 20

{
  "usersIds": "1,2,3"
}

No content

[ADMIN] Get all competitions

get

Retrieves a list of all competitions. Required admin role.

Authorizations
Responses
200
OK
*/*
get
GET /api/competitions HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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
  }
]

[ADMIN] Create a new competition

post

Creates a new competition object. Required admin role.

Authorizations
Body
namestringRequired

Name of the competition

Example: Code Battles 2023
descriptionstringRequired

Description of the competition

Example: A competitive coding event
startedAtstring · date-timeOptional

Start time of the competition

Example: 2023-01-01T10:00:00
endedAtstring · date-timeOptional

End time of the competition

Example: 2023-01-01T18:00:00
Responses
200
OK
*/*
post
POST /api/competitions HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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
}

Submit an answer

post

Allows a user to submit an answer for a specific competition problem.

Authorizations
Path parameters
compIdinteger · int64Required
Body

Request to send an answer

checkerinteger · int64Required

ID of the checker

Example: 1
srcstringRequired

Source code submitted as the answer

Example: print(input())
idinteger · int64Required

ID of the answer

Example: 1001
Responses
200
OK
*/*
Responsestring
post
POST /api/competitions/{compId}/send HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 46

{
  "checker": 1,
  "src": "print(input())",
  "id": 1001
}
text

Join to public competition problem by ID

post

Every user can join to public competition.

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
post
POST /api/competitions/{compId}/publicJoin HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*

No content

Get all answers

get

Retrieves all answers submitted by the authenticated user for a specific competition.

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId}/sends 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"
    }
  }
]

Get competition problems

get

Retrieves all problems associated with a specific competition.

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId}/problems HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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"
  }
]

Get competition problem by ID

get

Retrieves a specific problem by its ID within a competition.

Authorizations
Path parameters
compIdinteger · int64Required
idinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId}/problems/{id} HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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"
}

Get competition leaderboard

get

Retrieves the leaderboard for a specific competition.

Authorizations
Path parameters
compIdinteger · int64Required
Responses
200
OK
*/*
get
GET /api/competitions/{compId}/leaderboard HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
Accept: */*
{
  "score": [
    {
      "userId": 1,
      "userX": "text",
      "score": 1,
      "time": "2025-06-30T18:46:46.952Z"
    }
  ],
  "data": {
    "ANY_ADDITIONAL_PROPERTY": [
      {
        "userId": 1,
        "competitionproblemId": 1,
        "maxScore": 1
      }
    ]
  }
}

Get all public competitions

get

Retrieves a list of public competitions.

Authorizations
Responses
200
OK
*/*
get
GET /api/competitions/public HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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
  }
]

Get competitions available for user

get

Retrieves all competitions accessible to the authenticated user.

Authorizations
Responses
200
OK
*/*
get
GET /api/competitions/me HTTP/1.1
Host: localhost:8080
Authorization: Bearer JWT
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?