Internal API
See the backend API page for an explanation about how the API code is structured. All routes are found at the http://localhost:8000/api
endpoint in development and the /api
endpoint in production, which can be accessed on the frontend through the VITE_JURY_URL
environmental variable.
An example request looks like the following:
const projRes = await getRequest<Project[]>('/project/list', 'admin');
if (projRes.status !== 200) {
errorAlert(projRes);
return;
}
set({ projects: projRes.data as Project[] });
Note that this uses the getRequest
and errorAlert
frontend methods, which are described in the calling backend API page.
All Routes
All routes are listed in server/router/init.go
with their respective handlers.
Path | Method | Auth | Description |
---|---|---|---|
/ | GET | Heartbeat route | |
/judge/login | POST | Login judge | |
/admin/login | POST | Log into the admin dashboard | |
/judge/auth | POST | judge | Checks to see if judge is logged in |
/admin/auth | POST | admin | Checks to see if admin is logged in |
/judge/new | POST | admin | Add a new judge |
/judge/csv | POST | admin | Add judges by CSV |
/judge/list | GET | admin | Get list of all judges |
/judge/:id | DELETE | admin | Deletes a judge by ID |
/judge/:id | PUT | admin | Edit judge info |
/admin/groups/swap | POST | admin | Swaps the judge groups manually |
/admin/qr | POST | admin | Generate add judge QR code |
/admin/qr/:track | POST | admin | Generate add judge to track QR code |
/admin/qr | GET | admin | Gets add judge QR code |
/admin/qr/:track | GET | admin | Gets add judge to track QR code |
/qr/check/ | POST | Check if QR code is right | |
/qr/check/:track | POST | Check if track QR code is right | |
/qr/add | POST | Add judge from QR code | |
/project/new | POST | admin | Add a new project |
/project/devpost | POST | admin | Upload a Devpost CSV |
/project/csv | POST | admin | Add projects by CSV |
/project/list | GET | admin | get list of all projects |
/project/:id | DELETE | admin | Delete project by ID |
/project/:id | PUT | admin | Edit project info |
/admin/stats | GET | admin | Get all stats |
/admin/stats/:track | GET | admin | Get all stats for a track |
/project/stats | GET | admin | Get the stats for projects |
/judge/stats | GET | admin | Get the stats for judges |
/admin/flags | GET | admin | Gets all flags |
/admin/clock | GET | admin | Gets the current clock state |
/admin/clock/pause | POST | admin | Pauses the clock |
/admin/clock/unpause | POST | admin | Resumes the clock |
/admin/clock/backup | POST | admin | Backs up the clock to the database |
/admin/started | GET | Check if the clock is running | |
/admin/clock/reset | POST | admin | Resets the clock |
/admin/reset | POST | admin | Resets the entire database |
/project/reassign | POST | admin | Reassign all project table numbers |
/project/balance-groups | POST | admin | Balances project group numbers |
/project/reassign | POST | admin | Reassign all project table numbers |
/admin/timer | GET | judge | Gets the judge timer length |
/admin/options | GET | admin | Gets all config options set |
/admin/options | POST | admin | Sets config options |
/admin/tracks | POST | admin | Update the list of tracks |
/admin/track-views | POST | admin | Update the min views per track |
/admin/num-groups | POST | admin | Sets num of groups and reassigns nums |
/admin/group-sizes | POST | admin | Sets the size of groups and reassigns nums |
/admin/block-reqs | POST | admin | Sets whether to block login requests |
/admin/max-reqs | POST | admin | Sets the maximum number of logins/min |
/admin/export/judges | GET | admin | Exports judges as a CSV |
/admin/export/projects | GET | admin | Exports projects as a CSV |
/admin/export/challenges | GET | admin | Exports projects by challenge as ZIP of CSVs |
/admin/export/rankings | GET | admin | Exports a list of rankings for each judge |
/judge/hide/:id | PUT | admin | Hides a judge |
/project/hide/:id | PUT | admin | Hides a project |
/judge/move/group/:id | PUT | admin | Moves a judge to a different group |
/project/move/group/:id | PUT | admin | Moves a project to a different group |
/project/move/:id | PUT | admin | Moves a project to a different table number |
/project/prioritize/:id | PUT | admin | Prioritizes a project |
/project/prioritize | POST | admin | Prioritizes multiple projects |
/judge/hide | POST | admin | Hides multiple judges |
/project/hide | POST | admin | Hides multiple projects |
/judge/move/group | POST | admin | Moves multiple judges to a different group |
/project/move/group | POST | admin | Moves multiple projects to a different group |
/admin/flag/:id | DELETE | admin | Removes a flag |
/admin/deliberation | POST | admin | Toggles deliberation mode |
/admin/log | GET | admin | Gets the audit log |
/judge | GET | judge | Gets judge from token cookie |
/judge/welcome | GET | judge | Checks for read_welcome for a judge |
/judge/welcome | PUT | judge | Set read_welcome to true for a judge |
/judge/projects | GET | judge | Gets the list of projects a judge has seen |
/judge/next | POST | judge | Get next project for judge to view |
/judge/skip | POST | judge | Skips the current project with a reason |
/judge/finish | POST | judge | Finish viewing a project |
/judge/rank | POST | judge | Update judge rankings |
/judge/star/:id | PUT | judge | Update star ranking for a project |
/judge/notes/:id | PUT | judge | Update notes for a project |
/project/:id | GET | judge | Gets a project by ID |
/project/count | GET | judge | Gets the total number of projects |
/judge/project/:id | GET | judge | Gets a judged project by a judge |
/judge/deliberation | GET | judge | Returns if deliberation mode is on |
/project/list/public | GET | Gets a list of all projects for expo | |
/challenges | GET | Gets a list of all challenges | |
/group-info | GET | Gets a list of all group names |
Response Types
OK Response
Will return either as a success or failure. This will be represented with the following JSON, where 0 is failure and 1 is success.
{
"ok": 1
}
Error Response
All errors will be formatted in the following JSON:
{
"error": "error string"
}
Default Routes
Errors will return with a non-success status (generally 4xx).
GET /
Heartbeat route
- Auth: none
- Response: OK response
Login Routes
POST /judge/login
Login judge
- Auth: none
- Body: JSON
{
"code": "String | login code"
}
- Response: JSON
{
"token": "String | judge login token"
}
POST /admin/login
Log into the admin dashboard
- Auth: none
- Body: JSON
{
"password": "String | admin password"
}
- Response: OK response
POST /judge/auth
Checks to see if judge is logged in
- Auth: judge
- Response: OK response
POST /admin/auth
Checks to see if admin is logged in
- Auth: admin
- Response: OK response
Admin Panel (Judges) Routes
POST /judge/new
Add a new judge
- Auth: admin
- Body: JSON
{
"name": "String",
"email": "String",
"notes": "String"
}
- Response: OK response
POST /judge/csv
Add judges by CSV
- Auth: admin
- Body: FormData
csv
: CSV filehasHeader
: Boolean, true if CSV has a headernoSend
: Don't send email to judge if true
- Response: OK response
GET /judge/list
Get list of all judges
- Auth: admin
- Response: JSON List
[
{
"id": "ObjectId",
"token": "String",
"code": "String",
"name": "String",
"email": "String",
"active": "bool",
"track": "String",
"group": "String",
"read_welcome": "bool",
"notes": "String",
"current": "ObjectId",
"last_location": "int",
"seen": "int",
"group_seen": "int",
"seen_projects": [
{
"project_id": "ObjectID",
"starred": "bool",
"notes": "String",
"name": "String",
"location": "int",
"description": "String"
}
],
"rankings": ["ObjectId", "ObjectId | and so on for each ranked project"],
"last_activity": "DateTime"
}
]
DELETE /judge/:id
Deletes a judge by ID
- Auth: admin
- Parameter: ID, the ID of the judge to delete
- Response: OK response
PUT /judge/:id
Edit judge info
- Auth: admin
- Body: JSON
{
"name": "String",
"email": "String",
"notes": "String"
}
- Response: OK response
POST /admin/groups/swap
Swaps the judge groups manually
- Auth: admin
- Response: OK response
POST /admin/qr
Generate add judge QR code
- Auth: admin
- Response: JSON
{
"qr_code": "String"
}
POST /admin/qr/:track
Generate add judge to track QR code
- Auth: admin
- Response: JSON
{
"qr_code": "String"
}
GET /admin/qr
Gets add judge QR code
- Auth: none
- Response: JSON
{
"qr_code": "String"
}
GET /admin/qr/:track
Gets add judge to track QR code
- Auth: none
- Response: JSON
{
"qr_code": "String"
}
POST /qr/check
Checks if QR code is correct
- Auth: none
- Body: JSON
{
"code": "String"
}
- Response: OK response
POST /qr/check/:track
Checks if track QR code is correct
- Auth: none
- Body: JSON
{
"code": "String"
}
- Response: OK response
POST /qr/add
Add judge from QR code
- Auth: none
- Body: JSON
{
"name": "String",
"email": "String",
"notes": "String",
"code": "String | QR code token"
}
- Response: OK response