-
Notifications
You must be signed in to change notification settings - Fork 10
Scheduler API
Jonathan Shi edited this page Mar 3, 2019
·
1 revision
All endpoints listed below are prefixed by /api. This document exists so we can preserve the same interface while the backend gets refactored.
The schema of each endpoint is described by a table with the following columns:
| Field Name | Data Type | Description |
|---|
Any field marked with a * is possibly unnecessary, and we should consider removing it.
-
GET /courses/- Returns a list of basic information about all courses.
- Each object in the list has these required fields:
| id | int | object's primary key |
| name | slug | name of the course |
| validUntil | date (YYYY-MM-DD) | end date of course |
| enrollmentStart | datetime (ISO8601 with time zone) | start time of enrollment |
| enrollmentEnd | datetime (ISO8601 with time zone) | end time of enrollment |
-
GET courses/<slug:name/section/- Returns a list of all the sections within a given course.
- Each object in the list has these fields:
| id | int | object's primary key |
| course | int | the primary key of the associated course |
| mentor | Mentor (described below) | the mentor of the section |
| defaultSpacetime | Spacetime (described below) | the default date/time of the section |
| capacity | int | the theoretical max number of students in the section |
| enrolledStudents | int | the number of students currently enrolled in the section |
Mentor:
| id | int | the primary key of the mentor's Profile object |
| *course | int | the primary key of the course |
| role | string | the role of the mentor (JM, AM, SM) |
| user | User (described below) | the user object associated with the mentor |
User:
| *id | int | the primary key of the User object |
| *username | string | the mentor's username |
| firstName | string | the mentor's first name |
| lastName | string | the mentor's last name |
| string | the mentor's email |
Spacetime:
| location | string | the room of the section |
| startTime | time (HH:MM:SS) | the start time of the section |
| *dayOfWeekValue | string | one of [M, TU, W, TH, F, SA, SU]
|
| endTime | time (HH:MM:SS) | the end time of the section |
| dayOfWeek | string | the full name of the day of the week of the section |
-
GET /profiles/- If the user is not logged in, returns a 403.
- Otherwise, returns a list of profiles for the user.
- Each object in the list has the following fields:
| id | int | the primary key of the Profile
|
| leader | int? | the primary key of the Profile of this user's leader (possibly null) |
| course | int | the primary key of the Course this object belongs to |
| role | string | the role of the Profile (ST, JM, AM, SM, CO) |
| *user | int | the primary key of the User associated with this object |
section |
int | the primary key of the Section associated with this object |
-
GET /profiles/<int:pk>/- Returns details about the
Profilewith the specified primary key. If the requestedProfiledoes not belong to the logged in user (or if the user is not logged in), this will return a 403. - When the
verboseflag is not set, the returned schema is the same as that ofGET /profiles/. - When
verbose=true, thesectionfield is expanded with the following properties (rather than just a primary key):
- Returns details about the
| id | int | the primary key of the Section
|
| courseName | slug | the name of the Course
|
| mentor | Mentor (described above somewhere) | the mentor of the section, possibly this profile itself |
| defaultSpacetime | Spacetime (described above somewhere) | the spacetime of the section |
| activeOverride | Override? | honestly I'm not really sure, should probably be rewritten |
| isMentor | boolean | whether or not this object is for a mentor |
| attendances | [Attendance] (described below) | a list of attendances either for students in the section, or for this student |
Mentor profiles will also come with the following fields:
| capacity | int | the capacity of the section |
| students | [int] | the primary keys of the Profiles of the students in this section |
Attendance (to be changed to come with a date)
| <number> | string [2] | the key is the primary key of the attendance object, but apparently it's a string? the value is a 2-element list of (1) the student's name and (2) the attendance code |
-
DELETE /profiles/<int:pk>/unenroll- Drops a student from a section.
- Should 403 when attempting to drop a profile that's not yours.
(TODO)
-
GET /courses/<slug:name>/- Returns information about a specific course. Unused because it gives the same information as
/courses/
- Returns information about a specific course. Unused because it gives the same information as
-
GET /profiles/<int:pk>/attendance/- For students, returns a more detailed Attendance objects. Currently unused for mentors.