API Specification

Contributors: Alicia Wang, Conner Swenberg

Values wrapped in < > are placeholders for what the field values should be. Also be sure to read the request route carefully when you implement it.

Expected Functionality

Get all courses

GET/api/courses/

Response
<HTTP STATUS CODE 200>
{
    "courses": [
        {
            "id": 1,
            "code": "CS 1998",
            "name": "Intro to Backend Development",
            "assignments": [ <SERIALIZED ASSIGNMENT WITHOUT COURSE FIELD>, ... ],
            "instructors": [ <SERIALIZED USER WITHOUT COURSES FIELD>, ... ],
            "students": [ <SERIALIZED USER WITHOUT COURSES FIELD>, ... ]
        },
        {
            "id": 2,
            "code": "CS 1110",
            "name": "Intro to Computer Science: Python",
            "assignments": [ <SERIALIZED ASSIGNMENT WITHOUT COURSE FIELD>, ... ],
            "instructors": [ <SERIALIZED USER WITHOUT COURSES FIELD>, ... ],
            "students": [ <SERIALIZED USER WITHOUT COURSES FIELD>, ... ]
        }
        ...
    ]
}

Create a course

POST/api/courses/

If the client does not provide a code or name or both, respond with an error message with status code 400.

Get a specific course

GET/api/courses/{id}/

Delete a specific course

DELETE/api/courses/{id}/

Create a user

POST/api/users/

If the client does not provide a name or netid or both, respond with an error message.

Get a specific user

GET/api/users/{id}/

The courses field should contain ALL courses that user is in, both as a student and as an instructor (remember users can be both! Just like your backend instructors!).

Add a user to a course

POST/api/courses/{id}/add/

The field instructors or students in the response should include the newly added user in the respective array.

Create an assignment for a course

POST/api/courses/{id}/assignment/

If the client does not provide a title or due date or both, respond with an error message (status code 400).

Last updated

Was this helpful?