Skip to main content

Internal API

All routes are found at the http://localhost:8000/api endpoint, which can be accessed on the frontend through the VITE_JURY_URL environmental variable.

An example fetch request (The credentials: include allow for authentication cookies to be sent over):

const fetchedProjects = await fetch(`${import.meta.env.VITE_JURY_URL}/project/list`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
}).then((data) => data.json());
PathMethodAuthDescription
/judge/listGETadminget list of all judges
/judge/newPOSTadminAdd a new judge
/judge/csvPOSTadminPreview a judges csv
/judge/csv/uploadPOSTadminUpload judges using csv
/judge/statsGETadminGet the stats for the add judges page
/judge/loginPOSTLogin request for a judge
/judge/authPOSTtokenChecks to see if judge is logged in
/judge/welcomeGETtokenChecks for read_welcome for a judge
/judge/welcomePUTtokenSet read_welcome to true for a judge
/project/listGETadminget list of all projects
/project/newPOSTadminAdd a new project
/project/csvPOSTadminPreview a projects csv
/project/csv/uploadPOSTadminUpload projects using csv
/project/statsGETadminGet the stats for the add projects page
/project/devpostPOSTadminUpload a Devpost CSV
/project/:idGETtokenGet project by ID
/admin/loginPOSTLog into the admin dashboard
/admin/statsGETadminGet all stats
/admin/syncGETadminEstablish event stream with server
/admin/clockGETadminGets the current clock state
/admin/clock/pausePOSTadminPauses the clock
/admin/clock/unpausePOSTadminResumes the clock
/admin/clock/resetPOSTadminResets the clock

GET /judge/list

Get a list of all judges

Response

[
{
"id": "ObjectId",
"token": "String",
"code": "String",
"name": "String",
"email": "String",
"active": "bool",
"last_activity": "DateTime",
"read_welcome": "bool",
"notes": "String",
"next": "ObjectId",
"prev": "ObjectId",
"alpha": "f64",
"beta": "f64"
}
// ...
]

POST /judge/new

Requires admin password | Add a singular new judge

Request Body

{
"name": "String",
"email": "String",
"notes": "String"
}

Response

  • 200 Ok
  • Error + String

POST /judge/csv

Requires admin password | PREVIEW judge CSV file (does not upload)

Request Body

Content-Type: multipart/form-data

Fields:
- csv: CSV file upload
- hasHeader: Bool that is true if csv contains header

Response

[
{
"name": "String",
"email": "String",
"notes": "String"
}
// ...
]

or Error + String

POST /judge/csv/upload

Requires admin password | Upload judge CSV file

Request Body

Content-Type: multipart/form-data

Fields:
- csv: CSV file upload
- hasHeader: Bool that is true if csv contains header

Response

  • 200 Ok + Number of added judges as String
  • Error + String

GET /judge/stats

Requires admin password | Get the stats to display on the add judges page

Response

{
"num": 0, // u64 - Total # of judges
"alpha": 0.0, // f64 - Average alpha of judges
"beta": 0.0, // f64 - Average beta of judges
},

or Error + String

POST /judge/login

Login request for a judge

Request Body

{
"code": "String (6-digit login code for judge)"
}

Response

  • 200 Ok + Token as String
  • Error + String

POST /judge/auth

Requires judge token | Checks to see if judge is logged in

Response

  • 200 Ok if token is valid
  • 401 Unauthorized if token is invalid
  • 500 Internal Server Error

GET /judge/welcome

Requires judge token | Checks to see if a judge has read the welcome page

Response

{
"ok": true // Boolean, true or false
}

or Error

POST /judge/welcome

Requires judge token | Set the read_welcome field for a judge to true

Response

  • 202 Accepted
  • Error + String

GET /project/list

Get a list of all projects

Response

[
{
"id": "ObjectId",
"name": "String",
"location": "u64",
"description": "String",
"try_link": "String",
"video_link": "String",
"challenge_list": ["String"],
"seen": "u64",
"votes": "u64",
"mu": "f64",
"sigma_sq": "f64",
"active": "bool",
"prioritized": "bool",
"last_activity": "DateTime"
}
// ...
]

POST /project/new

Requires admin password | Add a singular new project

Request Body

{
"name": "String",
"description": "String",
"try_link": "String (Optional)",
"video_link": "String (Optional)",
"challenge_list": "String (Optional)"
}

Response

  • 200 Ok
  • Error + String

POST /project/csv

Requires admin password | PREVIEW project CSV file (does not upload)

Request Body

Content-Type: multipart/form-data

Fields:
- csv: CSV file upload
- hasHeader: Bool that is true if csv contains header

Response

[
{
"name": "String",
"location": "String",
"description": "String"
}
// ...
]

or Error + String

POST /project/csv/upload

Requires admin password | Upload project CSV file

Request Body

Content-Type: multipart/form-data

Fields:
- csv: CSV file upload
- hasHeader: Bool that is true if csv contains header

Response

  • 200 Ok + Number of added judges as String
  • Error + String

POST /project/devpost

Requires admin password | Upload CSV from devpost

Request Body

Content-Type: multipart/form-data

Fields:
- csv: CSV file upload

Response

  • Ok 200
  • Error + String

GET /project/:id

Requires judge token | Gets a project by ID

  • id - ID of the project

Response

  • Ok 200 with project data as JSON
  • Error

POST /admin/login

Login request for admins

Request Body

{
"password": "String (admin password)"
}

Response

  • 200 Ok + Password as String
  • Error + String

GET /admin/stats

Requires admin password | Get the stats to display on the admin dashboard

Response

{
"projects": 0, // u64 - Total # of projects
"seen": 0.0, // f64 - Average seen # of projects
"votes": 0.0, // f64 - Average votes of projects
"time": 0, // u64 - Current judging time in milliseconds
"avg_mu": 0.0, // f64 - Average mu value of projects
"avg_sigma": 0.0, // f64 - Average sigma^2 value of projects
"judges": 0 // u64 - Total # of judges
},

or Error

GET /admin/sync

Requires admin password | Establish event stream with server

Request

Response

Content-Type: text/event-stream

GET /admin/clock

Requires admin password | Get the current clock state

Response

{
"start": 0, // Start time in millis
"prev": 0, // Previously elapsed time, relavent if paused/previously paused
"paused": true // Bool, true if paused
}

or Error

POST /admin/clock/pause

Requires admin password | Pauses the clock

Response

  • Ok 200
  • InternalServerError 500 + String

POST /admin/clock/unpause

Requires admin password | Resumes the clock

Response

  • Ok 200
  • InternalServerError 500 + String

POST /admin/clock/reset

Requires admin password | Resets the clock

Response

  • Ok 200
  • InternalServerError 500 + String