-
Notifications
You must be signed in to change notification settings - Fork 0
API
In the following article, the API is documented.
The attribute role
definies, which User-Role can access the individual interface.
To authenticate a user, they must send a JWT
with each request.
To send the JWT
, the header Authorization
must be set with the following format: Bearer <token>
.
The JWT
is signed with a random 64-Byte Token, which will be regenerated at every restart of the server.
It expires after 12 Hours.
{
"id":user_id,
"username":"username",
"fullname":"fullname",
"role":"student"|"teacher"|"administrator",
"exp":time_to_expire,
"course": {
"id": 1,
"name": "course"
} //null if the person isn't assigned to a course
}
The middleware verifies and decodes the delievered JWT
, if the request is not to /user/login
.
If the JWT
could not be verified, a response with the HTTP-Status 401
and the message Invalid JWT
is send.
Register a new user
administrator
{
"username":"username",
"password":"password",
"role":"student"|"teacher"|"administrator",
"fullname":"fullname",
"address":"address",
"matriculationNumber":"matriculationNumber",
"mail":"[email protected]"
}
It may be noticed, that the role
will default to student
, if none of the role listed above is used.
On success returns the HTTP-Status 200
.
On failure returns the HTTP-Status 500
.
Try to login a user
Unauthenticated users
{
"username":"username",
"password":"password
}
On success returns the HTTP-Status 200
and a JWT
for authentication.
On failure returns the HTTP-Status 403
and the message Wrong username or password
.
Deletes a user from the repository
administrator
{
"username":"username"
}
On success returns the HTTP-Status 200
and the message The user has been deleted
.
On failure returns the HTTP-Status 500
and the message The user could not be deleted
.
Change the password of the given user
student
& teacher
may only change their own password.
administrator
may change their own password as the password of other users.
{
"username":"username",
"password":"password
}
On success returns the HTTP-Status 200
and the message The password has been changed
.
On failure returns the HTTP-Status 500
and the message Password could not be changed
.
Get all users
administrator
No request data
An array of the following JSON-Objects
{
"id": 5,
"fullname": "fullname",
"address": "address",
"matriculationNumber": "matriculationNumber",
"mail": "[email protected]",
"userId": {
"id": 14,
"username": "username",
"isTeacher": false|true,
"isAdministrator": false|true,
"course": {
"id": 1,
"name": "course"
} //null if the person isn't assigned to a course
}
}
Returns the grades of the student specified in :studentId
student
may only see his own grades
administrator
may see the grades of all students
No request data
An array with the following JSON-Objects
{
"grade": 3,
"weight": 100,
"moduleId": {
"id": 1,
"name": "Test",
"description": "Test"
}
}
Returns the grades of the module specified in :moduleId
teacher
may only see the grades of his own modules
administrator
may see the grades of all modules
No request data
An array with the following JSON-Objects
{
"id": 1
"grade": 3,
"weight": 100,
"studentId": {
"id": 1,
"username": "student"
},
"studentDetails": {
"fullname": "fullname",
"matriculationNumber": "matriculationNumber"
}
}
Insert or update a new grade
teacher
may insert or update new grades for his module
administrator
may insert or update new grades for every module
{
"id":1, // Only needed if updating a existing grade
"moduleId":1,
"studentId":1,
"grade":1,
"weight":100
}
On success returns the HTTP-Status 200
and the message The grade has been saved
.
On failure returns the HTTP-Status 500
and the message The grade has not been saved
.
Delete the grade
teacher
for their own modules
administrator
for every module
{
"id":1, // Only needed if updating a existing grade
"moduleId":1,
"studentId":1,
"grade":1,
"weight":100
}
On success returns the HTTP-Status 200
and the message The grade has been deleted
.
On failure returns the HTTP-Status 500
and the message The grade could not be deleted
.
Insert or update a new entry into the timetable
teacher
can insert entries for their module
administrator
can insert entries for every module
{
"id":1, // Only needed if updating a existing entry
"startTime":Date,
"endTime":Date,
"assignedModule":1,
"description":"description", // can be null
"room":"A38"
}
On success returns the HTTP-Status 200
and the message The entry has been saved
.
On failure returns the HTTP-Status 500
and the message The entry could not be saved
.
Retrieve entries for a person
teacher
may get the entries for their modules
student
may get the entries for their assigned course
No request data
A array with the following JSON-Objects
{
"id": 2,
"startTime": "2022-02-02T11:30:19.490Z",
"endTime": "2022-02-02T12:30:19.490Z",
"description": null,
"room": "A13",
"assignedModule": {
"id": 1,
"name": "tset",
"description": "Test",
"assignedCourse": {
"id": 1,
"name": "test"
}
}
}
Retrieve entries for a module, specified by :moduleId
tbd
No request data
A array with the following JSON-Objects
{
"id": 2,
"startTime": "2022-02-02T11:30:19.490Z",
"endTime": "2022-02-02T12:30:19.490Z",
"description": null,
"room": "A13",
"assignedModule": {
"id": 1,
"name": "tset",
"description": "Test"
}
}
Retrieve entries for a module, specified by :courseId
tbd
No request data
A array with the following JSON-Objects
{
"id": 2,
"startTime": "2022-02-02T11:30:19.490Z",
"endTime": "2022-02-02T12:30:19.490Z",
"description": null,
"room": "A13",
"assignedModule": {
"id": 1,
"name": "tset",
"description": "Test",
"assignedCourse": {
"id": 1,
"name": "test"
}
}
}
Delete a entry
teacher
may delete the entries of their own module
administrator
may delete all entries
{
"id":1,
"startTime":Date,
"endTime":Date,
"assignedModule":1,
"description":"description", // can be null
"room":"A38"
}
On success returns the HTTP-Status 200
and the message The entry has been deleted
.
On failure returns the HTTP-Status 500
and the message The entry could not be deleted
.
Change the name of a course
administrator
{
"newName":"newCoursename"
}
On success returns the HTTP-Status 200
and the message The course has been updated
.
On failure returns the HTTP-Status 500
and the message Course could not be updated
.
Register a new course
administrator
{
"name":"coursename",
"students":"list of student_id"
}
On success returns the HTTP-Status 200
.
On failure returns the HTTP-Status 403
.
Delete a course
administrator
No request data
On success returns the HTTP-Status 200
and the message The course has been deleted
.
On failure returns the HTTP-Status 500
and the message Course could not deleted updated
.
Add students to a course
administrator
{
"students":"list of student_id"
}
On success returns the HTTP-Status 200
and the message The students have been added
.
On failure returns the HTTP-Status 500
and the message Students could not be added
.
Deletes students from a course
administrator
{
"students":"list of student_id"
}
On success returns the HTTP-Status 200
and the message The students have been deleted
.
On failure returns the HTTP-Status 500
and the message Students could not be deleted
.
Return the informations of a course
tbd
No request data
On success returns the HTTP-Status 200
and a Course-Object.
On failure returns the HTTP-Status 500
and the message Could not find the course
.
Return all course, with their assigned students and their assigned modules
administrator
may see all courses
No request data
On success return the HTTP-Status 200
and a array of the following objects
{
"id": 1,
"name": "course",
"students": [
{
"id": 4,
"userDetail": {
"fullname": "student"
}
}
],
"assignedModules": [
{
"id": 1,
"name": "module"
}
]
}
Register a new module
administrator
{
"name": "modulename",
"description": "description",
"assignedTeacher": "list of teacher_id",
"assignedCourse": "course_id",
"submodule": "list of submodule_id"
}
On success returns the HTTP-Status 200
.
On failure returns the HTTP-Status 403
.
Changes the name of a module
administrator
{
"name": "newname"
}
On success returns the HTTP-Status 200
and the message The Name has been changed
.
On failure returns the HTTP-Status 500
and the message Name could not be changed
.
Adds a submodule to a module
administrator
{
"submodule": "List of submodule_id"
}
On success returns the HTTP-Status 200
and the message The Submodule have been added
.
On failure returns the HTTP-Status 500
and the message Submodule could not be added
.
Deletes a submodule of a module
administrator
{
"submodule": "List of submodule_id"
}
On success returns the HTTP-Status 200
and the message The Submodule have been deleted
.
On failure returns the HTTP-Status 500
and the message Submodule could not bee deleted
.
Changes the description of a module
administrator
{
"description": "new description"
}
On success returns the HTTP-Status 200
and the message The Description has been changed
.
On failure returns the HTTP-Status 500
and the message Description could not be changed
.
Deletes the course from the module
administrator
No request data
On success returns the HTTP-Status 200
and the message The Course has been deleted
.
On failure returns the HTTP-Status 500
and the message Course could not be deleted
.
Add a course to the module
administrator
{
"course": "course_id"
}
On success returns the HTTP-Status 200
and the message The Course has been added
.
On failure returns the HTTP-Status 500
and the message Course could not be added
.
Add a teacher to the module
administrator
{
"teacher": "list of teacher_id"
}
On success returns the HTTP-Status 200
and the message The Teacher has been added
.
On failure returns the HTTP-Status 500
and the message Teacher could not be added
.
Deletes a teacher from the module
administrator
{
"teacher": "list of teacher_id"
}
On success returns the HTTP-Status 200
and the message The Teacher has been deleted
.
On failure returns the HTTP-Status 500
and the message Teacher could not be deleted
.
Deletes the module
administrator
No request data
On success returns the HTTP-Status 200
and the message The Module has been deleted
.
On failure returns the HTTP-Status 500
and the message Module could not be deleted
.
Return the information of a module
tbd
No request data
On success returns the HTTP-Status 200
and the Module-Object.
On failure returns the HTTP-Status 500
and the message Could not find the module
.
Return all modules of the specific module
students
and teacher
can get all their assigned modules
No request data
On success returns the HTTP-Status 200
and a array of the following objects
{
"id": 1,
"name": "module",
"description": "module"
}
On failure returns the HTTP-Status 500
and the message Could not retrieve modules
.
Registers a new ModuleItem for the Module
administrator
{
"content": "content",
"webLink": "webLink",
"hasFileUpload": boolean,
"downloadableFile": {
"owner": "user_id",
"name": "name",
"path": "path"
},
"isVisible": "boolean",
"dueDate": "dueDate"
}
On success returns the HTTP-Status 200
.
On failure returns the HTTP-Status 403
.
Return the information of a moduleitem
tbd
No request data
On success returns the HTTP-Status 200
and the moduleitem.
On failure returns the HTTP-Status 500
and the message ModuleItem could not be found
.
Return the informations of all moduleitems
tbd
No request data
On success returns the HTTP-Status 200
and the moduleitems.
On failure returns the HTTP-Status 500
and the message No ModuleItems found for Module
.
Changes a moduleitem
teacher
may only change their own moduleitems, administrator
may change every moduleitem
{
"content": "content",
"webLink": "webLink",
"hasFileUpload": boolean,
"isVisible": boolean,
"dueDate": "dueDate"
}
On success returns the HTTP-Status 200
and the message ModuleItem has been changed
.
On failure returns the HTTP-Status 500
and the message ModuleItem could not be changed
.
Deletes a moduleitem
teacher
may only delete their own moduleitems, administrator
may delete every moduleitem
No request data
On success returns the HTTP-Status 200
and the message The ModuleItem has been deleted
.
On failure returns the HTTP-Status 500
and the message ModuleItem could not be deleted
.
Deletes all moduleitems of a module
teacher
may only delete their own moduleitems, administrator
may delete every moduleitem
No request data
On success returns the HTTP-Status 200
and the message The ModuleItems have been deleted
.
On failure returns the HTTP-Status 500
and the message ModuleItems could not be deleted
.
Registers a downloadable file for a moduleitem
teacher
may only add to their own moduleitems, administrator
may add every moduleitem
{
"owner": "user_id",
"name": "name",
"path": "path"
}
On success returns the HTTP-Status 200
and the message Added new File to ModuleItem
.
On failure returns the HTTP-Status 500
and the message Could not add File to ModuleItem
.
Deletes the downloadable file from a moduleitem
teacher
may only add to their own moduleitems, administrator
may add every moduleitem
No request data
On success returns the HTTP-Status 200
and the message Deleted File
.
On failure returns the HTTP-Status 500
and the message Could not delete File
.
Registers a uploaded file for a moduleitem if allowed
No permission restrictions
{
"owner": "user_id",
"name": "name",
"path": "path"
}
On success returns the HTTP-Status 200
and the message File has been uploaded
.
On failure returns the HTTP-Status 500
and the message Could not upload File
.
Deletes a uploaded file from a moduleitem
student
& teacher
may delete their own file, administrator
may delete all files
{
"fileId": "file_id"
}
On success returns the HTTP-Status 200
and the message File has been deleted
.
On failure returns the HTTP-Status 500
and the message Could not delete file
.
Deletes all uploaded file from a moduleitem
teacher
may delete files from their own moduleitems, administrator
may delete all files
No request data
On success returns the HTTP-Status 200
and the message Files have been deleted
.
On failure returns the HTTP-Status 500
and the message Could not delete files
.