Skip to content
Alexander Van Oyen edited this page Feb 25, 2024 · 27 revisions

We will probably be using swagger/openAPI for our API implementation.

API requests

Admin

(Admins should be able to perform every request, they will have no restrictions.)

Method Endpoint Description Status Code Success
POST /user create a new user (returns the id) 201
PUT /user/{userid} update user data 200
DELETE /user/{userid} delete a user 200/204 (depends if you return the deletd data or not)
GET /user/{userid} get user data 200

Teacher

Method Endpoint Description Status Code Success
POST /subject create a new subject (returns the id) 201
DELETE /subject/{subject_id} delete subject with given id 200/204 (depends if you return the deletd data or not)
PUT /subject/{subject_id} update subject data 200
GET /subject/{subject_id} get all data about a subject 200
POST /subject/{subject_id}/project create a new project for a subject 201
DELETE /subject/{subject_id}/project/{project_id} delete a project from a subject 200/204 (depends if you return the deletd data or not)
GET /subject/{subject_id}/project/{project_id} get all data about a project (get submissions) 200
PUT /subject/{subject_id}/project/{project_id} update project data (for example: visibility of project) 200
POST /subject/{subject_id}/project/{project_id} Archive project 201
POST /user/subject/{subject_id}/project/{project_id}/group/{group_id} create new group for project 201
PUT /user/subject/{subject_id}/project/{project_id}/group/{group_id} update group data 200

Student

Method Endpoint Description Status Code Success
GET /user get all user data (can only access own data) 200
PUT /user update user data (can only update own data) 200
DELETE /user remove the user (can only remove themself) 200/204 (depends if you return the deletd data or not)
POST /user/subject/{subject_id} subscribe to subject 200
PUT /user/subject/{subject_id} unsubscribe to subject 200
POST /user/subject/{subject_id}/project/{project_id} submit project 200
PUT /user/subject/{subject_id}/project/{project_id} update project submission 200
GET /user/subject/{subject_id}/project/{project_id} get project submission 200
POST /user/subject/{subject_id}/project/{project_id}/group/{group_id} join group 200
GET /user/subject/{subject_id}/project/{project_id}/group/{group_id} get group data (members, ...) 200

Status code on bad request

  • 401: This status code is returned when the client is unauthorized to perform this request. Example: This could happen when a user tries to delete another user.
  • 403: The user is unauthorized but known.
  • 404: wrong endpoint (could mean that the group/user/subject id's are wrong)
Clone this wiki locally