Student APIs (Dashboard & My Work)
This page documents the student-facing APIs (mounted under /api/student) used by the student UI: dashboard, my-work, course structure, assignments, quizzes, projects, and task submissions. All details are read-only extracts from ILS-dev/backend/routes/student.js.
Authentication
- All endpoints require an authenticated JWT session. Endpoints return
401when not authenticated.
Common error cases
400— missing required parameters401— not authenticated403— action forbidden (example: sequence lock preventing submission)404— resource not found500— server error
Key endpoints
- GET /api/student/my-work
- Purpose: list enrolled classes and pending/graded assignments per class.
-
Response: array of class objects each with an
assignmentsarray. Each assignment entry includesassignment_id,assignment_title,points_possible,submission_id,submission_status,overall_score,submitted_at. -
GET /api/student/courses
-
Purpose: list distinct courses the student is enrolled in.
-
GET /api/student/courses/:courseId/curriculum
-
Purpose: return Period → Module list for the student's enrolled classes in the course. Frontend uses this to render curriculum pages lazily.
-
GET /api/student/courses/:courseId/enrolled-modules
-
Purpose: returns
module_idandclass_idpairs for modules the student is enrolled in for the course. -
GET /api/student/course-structure
-
Purpose: full Period → Module → Assignment tree for the student's active enrollments. Each assignment includes the student's latest
submission(if any). -
GET /api/student/assignments/:assignmentId?classId=X
- Purpose: full assignment detail for the student: assignment metadata, rubric criteria with ratings, and the student's most-recent submission (if any).
-
Notes: If
classIdis omitted the server attempts to auto-resolve the class from the student's enrollments where the assignment appears. -
POST /api/student/submissions
- Purpose: create (or return existing) a draft submission for an assignment.
-
Body:
{ assignment_id, class_id }→ returns{ submission_id, status, overall_score, submitted_at }. Returns201when created, or existing submission row if present. -
PATCH /api/student/submissions/:id/submit
- Purpose: student submits a draft submission. Transitions
draft→submittedand incrementsattempt_number. - Behavior & validations:
- Checks sequence locks: finds the
module_itemsrow for the assignment and class and computes locked items viacomputeLockedItems(...). If the item is locked the server returns403with message "This item is locked. Complete the previous item first." -
Respects
submission_attemptson the assignment; returns400if max attempts reached. -
GET /api/student/dashboard
- Purpose: aggregated student stats for their dashboard.
- Response shape (abridged):
{
"stats": { "total_assignments": 42, "graded": 10, "submitted": 3, "pending": 29, "avg_score": 7.4 },
"recent_grades": [{ "assignment_title": "Essay", "overall_score": 85, "score10": 8.5 }],
"outcomes": [{ "id": 11, "code": "OC.1", "name": "Research", "avg_score10": 7.1, "graded_count": 3 }]
}
- GET /api/student/my-assessments
-
Purpose: flat list of assignments across enrolled classes with submission status and scores (
submission_id,submission_status,overall_score). -
GET /api/student/my-quizzes
-
Purpose: flat list of quizzes with last attempt (via LATERAL subquery). Returns
submission_id,submission_status,submission_score,attempt,submitted_at. -
Projects & task submissions
GET /api/student/my-projects— list projects assigned to student's classes with per-project task progress and earned/possible totals.GET /api/student/projects/:projectId— project overview (auto-resolvesclassIdwhen omitted), phases and tasks.GET /api/student/projects/:projectId/tasks/:taskId— task detail with rubric, ratings, student submission, files and criterion scores.POST /api/student/task-submissions— upsert a draft task submission. Body:{ task_id, class_id, text_response? }.PATCH /api/student/task-submissions/:id— autosave text_response (cannot edit when submitted/graded).PATCH /api/student/task-submissions/:id/submit— mark task submission as submitted.
File uploads for task submissions
POST /api/student/task-submissions/:id/files— multipart upload; form field namefile; allowed types: PDF, Word, Excel, PowerPoint, images, text; max 20 MB. Returns201with created file metadata.DELETE /api/student/task-submissions/:id/files/:fileId— delete a file (auth + ownership check).GET /api/student/task-submissions/:id/files/:storedName— download the file (auth + ownership check).
Module item lock awareness
GET /api/student/modules/:moduleId/items?classId=— returns module items and computesis_lockedfor the current student usingcomputeLockedItems(sequelize, items, userId, classId). TheclassIdquery parameter is required for correct lock evaluation.
Implementation notes & cautions
- Many endpoints auto-resolve
classIdfrom the student's enrollments when omitted, but the frontend should passclassIdwhen available for precise behaviour. - Sequence locks are enforced server-side on submission; the frontend should read
/api/student/modules/:moduleId/items?classId=to computeis_lockedand surface UI affordances. - Quizzes queries use
LATERALqueries to fetch the most recent quiz attempt per class for the student. - Deleted rows are generally filtered by
deleted_at IS NULLin SQL queries.
References (read-only)
ILS-dev/backend/routes/student.js
Last updated: 2026-07-08