/grade-tracker-api

RESTful API for Grade Tracker app.

Primary LanguageJava

Grade Tracker API

Authorization

POST /api/auth/google-signin

Request:
Body: ID token string provided by Google Identity service.
Content type: text/plain.

Response:
401 (invalid ID token string)
200 (success; returns token as cookie)

Classes

All endpoints requires user authorization.

POST /api/classes

Adds an enrolled class for the authorized user.

Request body (JSON):

course_name (String) Name of the course.
section (String) Signle character.
term (String) Valid values are: FALL, WINTER, SUMMER.
year (Integer) Four digit year.

Response:
201 (success; returns the newly created object)
401 (unauthorized)

GET /api/classes

Response:
200 (success; returns an array of class objects)

DELETE /api/classes/{id}

Response:
204 (success)
403 (if the class doesn't belong to the user)

Activities

All endpoints requires user authorization.

POST /api/classes/{id}/activities

Adds an activity in the provided class.

Request body (JSON):

name (String) Name of the activity. For example, quiz, test, assignment etc.
weight (Double) Weight of the activity in the final grade in percentage.
total (Double) (Optional) Total score on which the activity is graded on. For example, weight may be 5% but the total score can be 100.
Can be excluded if unknown.
score (Double) (Optional) Score achieved by the user.
Can be excluded to indicate that the activity has not been graded yet.

Response:
201 (success; returns the newly created activity)
401 (unauthorized)

POST /api/classes/{id}/activities/ordering

Changes the order of activities.

Request body: Ordered JSON array of activity ids. If one or more activity ids are not provided but they are in the class, then they are put at the end of newly ordered activities.

Response:
200 (success; returns activity list)

PATCH /api/activities/{id}

Updates the provided activity. Usually used for updating the 'score' attribute.

Request body (JSON): Same as the post endpoint, but all keys are optional.

Response: 200 (succeed; returns the updated activity)

DELETE /api/activities/{id}

Response:
204 (success)