- Introduction
- Authentication
- Users
- Materials
- Announcements
- Previous Exams
- Leaderboard
- Useful Links
- Verification
This document provides detailed information about the FCIS LOL API endpoints, their functionality, required parameters, and expected responses.
All protected routes require a valid JWT token in the Authorization header:
Authorization: Bearer <token>
Authenticate a user and obtain a JWT token.
Request Body:
{
"email": "string",
"password": "string"
}Response:
- 200 OK: Returns a JWT token and user data.
- 400 Bad Request: If email or password is missing or invalid.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"message": "success",
"token": "Bearer <token>",
"user": {
"name": "string",
"email": "string",
"semester": "string",
"role": "string",
"photo": "string | null"
}
}Retrieve the currently authenticated user's data.
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns user data.
- 401 Unauthorized: If the token is invalid or missing.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"id": "number",
"email": "string",
"name": "string",
"semester": "string",
"role": "string",
"phone": "string | null",
"photo": "string | null"
}Updates the authenticated user's profile information.
Headers:
Authorization: Bearer token required for authentication
Request Body:
{
"name": "New Name", // optional
"email": "new@email.com", // optional
"phone": "1234567890", // optional
"photo": "photo_url", // optional
"semester": "One", // optional
"oldPassword": "old", // optional
"newPassword": "new", // optional
"newPasswordConfirm": "new" // optional
}Create a new user account.
Request Body:
{
"name": "string",
"email": "string",
"password": "string",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight",
"phone": "string (optional)",
"photo": "string (optional)",
"fcmToken": "string (optional)"
}Response:
- 200 OK: Returns created user data and JWT token.
- 400 Bad Request: If there are validation errors.
- 500 Internal Server Error: If there is an issue with the server or if a user already exists with the provided email.
Example Response:
{
"message": "success",
"token": "Bearer <token>",
"user": {
"id": "number",
"name": "string",
"email": "string",
"semester": "string",
"role": "STUDENT",
"score": 0,
"photo": "string | null"
}
}Retrieve user information. Note: Password is always excluded from responses.
Query Parameters:
id(optional): ID of the user to retrieve.haveMaterial(optional): "true" or "false" to include user's materials.
Response:
- 200 OK: Returns user data or list of users.
- 404 Not Found: If the user is not found (when ID is provided).
- 500 Internal Server Error: If there is an issue with the server.
Example Response (single user):
{
"id": "number",
"name": "string",
"email": "string",
"semester": "string",
"role": "string",
"score": "number",
"photo": "string | null",
"material": [] // Only included if haveMaterial=true
}Example Response (multiple users):
[
{
"id": "number",
"name": "string",
"email": "string",
"semester": "string",
"role": "string",
"score": "number",
"photo": "string | null",
"material": [] // Only included if haveMaterial=true
}
]Update an existing user account. Note: Only admins can update any user's data, while regular users can only update their own account.
Query Parameters:
id: ID of the user to update.
Headers:
- Authorization: Bearer token
Request Body (all fields optional):
{
"name": "string",
"email": "string",
"password": "string",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight",
"phone": "string",
"photo": "string"
}Response:
- 200 OK: Returns the updated user data.
- 400 Bad Request: If there are validation errors or missing ID.
- 401 Unauthorized: If the token is invalid or missing, or if the user is not authorized to update the account.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"id": "number",
"name": "string",
"email": "string",
"semester": "string",
"role": "string",
"score": "number",
"photo": "string | null"
}Update a user's last active timestamp. Note: Users can only update their own last active status.
Query Parameters:
id: User ID (required)
Headers:
- Authorization: Bearer token (required)
Response:
- 200 OK: Returns updated user data
- 400 Bad Request: If user ID is missing
- 401 Unauthorized: If token is invalid or user tries to update another user's status
- 500 Internal Server Error: If there is an issue with the server
Example Response:
{
"id": "number",
"email": "string",
"name": "string",
"semester": "string",
"role": "string",
"lastActive": "string (ISO date)",
"phone": "string | null",
"photo": "string | null"
}Delete a user account. This operation can only be performed by users with DEV role or by the account owner themselves. When a user is deleted, all their materials are transferred to a system account (ID 0).
Query Parameters:
id: ID of the user to delete.
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns the deleted user's data and confirmation message.
- 400 Bad Request: If the user ID is missing.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the requester doesn't have permission to delete the account (not owner or DEV).
- 403 Forbidden: If attempting to delete the system account (ID 0).
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"message": "User deleted successfully",
"user": {
"id": "number",
"name": "string",
"email": "string",
"semester": "string",
"role": "string",
"score": "number",
"photo": "string | null"
}
}Retrieve material information.
Query Parameters:
accepted: "true" or "false" (required)- Either
subjectORsemesteris required (cannot use both):subject: Filter materials by subjectsemester: Filter materials by semester
Response:
- 200 OK: Returns a list of materials.
- 400 Bad Request: If required parameters are missing or invalid.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
[
{
"id": "number",
"subject": "string",
"link": "string",
"type": "DOCUMENT | VIDEO | OTHER",
"title": "string",
"description": "string | null",
"author": {
"id": "number",
"name": "string",
"photo": "string | null"
}
}
]Create a new material entry. Note: Materials posted by admins are automatically accepted and the admin receives a score point.
Headers:
- Authorization: Bearer token
Request Body:
{
"subject": "string",
"link": "string",
"type": "DOCUMENT | VIDEO | OTHER",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight",
"title": "string",
"description": "string (optional)"
}Response:
- 201 Created: Returns the created material.
- 400 Bad Request: If there are validation errors.
- 401 Unauthorized: If the token is invalid or missing.
- 500 Internal Server Error: If there is an issue with the server.
Updates an existing material resource. Only users with the ADMIN role can perform this operation.
Headers:
Authorization: Bearer token required for authentication and authorization.
Request Body:
{
"id": 1, // required, the unique identifier of the material to update
"subject": "SUBJECT_NAME", // optional
"link": "https://example.com/resource", // optional
"type": "MATERIAL_TYPE", // optional
"semester": "SEMESTER_VALUE", // optional
"title": "Resource Title", // optional
"description": "Detailed description of the material" // optional
}Response:
- 200 OK: Example Response
{
"success": true,
"material": {
"id": 1,
"subject": "SUBJECT_NAME",
"link": "https://example.com/resource",
"type": "MATERIAL_TYPE",
"semester": "SEMESTER_VALUE",
"title": "Resource Title",
"description": "Detailed description of the material"
}
}Update the accepted status of a material (Admin only). Note: When a material is accepted, the author receives a score point.
Query Parameters:
id: ID of the material to update.accepted: "true" or "false"
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns the updated material.
- 400 Bad Request: If there are invalid parameters.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user is not an admin.
- 500 Internal Server Error: If there is an issue with the server.
Retrieve a specific material by ID.
Query Parameters:
id: ID of the material to retrieve.
Response:
- 200 OK: Returns the material.
- 400 Bad Request: If the ID is missing.
- 500 Internal Server Error: If there is an issue with the server.
Delete a material entry.
Headers:
- Authorization: Bearer token
Request Body:
{
"id": "number"
}Response:
- 200 OK: Returns a success message.
- 400 Bad Request: If the material ID is missing.
- 401 Unauthorized: If the token is invalid or missing.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"message": "Material deleted"
}Retrieve announcement information.
Query Parameters:
id(optional): ID of the announcement to retrieve.semester(optional): Filter announcements by semester.
Response:
- 200 OK: Returns announcement data.
- 404 Not Found: If the announcement is not found (when ID is provided).
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
[
{
"id": "number",
"title": "string",
"content": "string",
"due_date": "DateTime | null",
"type": "Assignment | Quiz | Practical | Final | Workshop | Summer_Training | Faculty | Other",
"semester": "string",
"image": "string | null"
}
]Create a new announcement (Admin only).
Headers:
- Authorization: Bearer token
Request Body:
{
"title": "string",
"content": "string",
"due_date": "2021-09-30T00:00:00.000Z", (optional)
"type": "Assignment | Quiz | Other",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight",
"image": "string (optional)"
}Response:
- 201 Created: Returns the created announcement.
- 400 Bad Request: If there are validation errors.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user is not an admin.
- 500 Internal Server Error: If there is an issue with the server.
Update an existing announcement (Admin only).
Query Parameters:
id: ID of the announcement to update.
Headers:
- Authorization: Bearer token
Request Body: Same as POST, all fields optional.
Response:
- 200 OK: Returns the updated announcement.
- 400 Bad Request: If there are validation errors.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user is not an admin.
- 404 Not Found: If the announcement is not found.
- 500 Internal Server Error: If there is an issue with the server.
Delete an announcement (Admin only).
Query Parameters:
id: ID of the announcement to delete.
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns the deleted announcement details.
- 400 Bad Request: If the ID is missing.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user is not an admin.
- 500 Internal Server Error: If there is an issue with the server.
Delete expired announcements automatically (system endpoint).
Response:
- 200 OK: Returns the number of deleted announcements
- 500 Internal Server Error: If there is an issue with the server
Retrieve previous exam information.
Query Parameters:
accepted: "true" or "false" (required)- Either
subjectORsemesteris required (cannot use both):subject: Filter exams by subjectsemester: Filter exams by semester
Response:
- 200 OK: Returns a list of previous exams.
- 400 Bad Request: If required parameters are missing or invalid.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
[
{
"id": "number",
"title": "string",
"link": "string",
"type": "Mid | Final | Other",
"subject": "string",
"createdAt": "date"
}
]Create a new previous exam entry. Note: Exams posted by admins are automatically accepted and the admin receives a score point.
Headers:
- Authorization: Bearer token
Request Body:
{
"subject": "string", // required
"link": "string", // required
"type": "Mid | Final | Other", // required
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight", // required
"title": "string" // required
}Response:
- 201 Created: Returns the created exam.
- 400 Bad Request: If there are validation errors.
- 401 Unauthorized: If the token is invalid or missing.
- 500 Internal Server Error: If there is an issue with the server.
Delete a previous exam entry. Only users with ADMIN or DEV roles can perform this operation.
Headers:
- Authorization: Bearer token
Request Body:
{
"id": "number"
}Response:
- 200 OK: Returns a success message.
- 400 Bad Request: If the exam ID is missing.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user doesn't have ADMIN or DEV role.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"message": "Exam deleted"
}Retrieve a specific previous exam by ID.
Query Parameters:
id: ID of the exam to retrieve.
Response:
- 200 OK: Returns the exam.
- 400 Bad Request: If the ID is missing.
- 500 Internal Server Error: If there is an issue with the server.
Updates an existing previous exam. Only users with ADMIN or DEV roles can perform this operation.
Headers:
Authorization: Bearer token required for authentication and authorization.
Request Body:
{
"id": 1, // required, the unique identifier of the exam to update
"Subject": "SUBJECT_NAME", // optional
"link": "https://example.com/resource", // optional
"Type": "Mid | Final | Other", // optional
"Semester": "SEMESTER_VALUE", // optional
"title": "Exam Title" // optional
}Response:
- 200 OK: Example Response
{
"success": true,
"exam": {
"id": 1,
"subject": "SUBJECT_NAME",
"link": "https://example.com/resource",
"type": "Mid | Final | Other",
"semester": "SEMESTER_VALUE",
"title": "Exam Title",
"accepted": true
}
}Update the accepted status of a previous exam. Only users with ADMIN or DEV roles can perform this operation.
Query Parameters:
id: ID of the exam to update.accepted: "true" or "false"
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns the updated exam.
- 400 Bad Request: If there are invalid parameters.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user doesn't have ADMIN or DEV role.
- 500 Internal Server Error: If there is an issue with the server.
Fetch the current leaderboard data.
Query Parameters:
semester: Filter leaderboard by semester.
Response:
- 200 OK: Returns leaderboard data.
- 400 Bad Request: If the semester is invalid.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
[
{
"id": "number",
"name": "string",
"score": "number"
}
]Retrieve useful links information.
Query Parameters:
id(optional): ID of the specific useful link to retrieve.semester(optional): Filter useful links by semester.subject(optional): Filter useful links by subject.isGeneral(optional): Filter useful links by general status ("true" or "false").
Response:
- 200 OK: Returns useful link data or list of useful links.
- 404 Not Found: If the useful link is not found (when ID is provided).
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
[
{
"id": "number",
"link": "string",
"subject": "string",
"semester": "string",
"isGeneral": "boolean"
}
]Create a new useful link (DEV role only).
Headers:
- Authorization: Bearer token
Request Body:
{
"link": "string",
"subject": "string",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight",
"isGeneral": "boolean (optional, defaults to false)"
}Response:
- 201 Created: Returns the created useful link.
- 400 Bad Request: If there are validation errors.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user doesn't have DEV role.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"id": "number",
"link": "string",
"subject": "string",
"semester": "string",
"isGeneral": "boolean"
}Update an existing useful link (DEV role only).
Query Parameters:
id: ID of the useful link to update.
Headers:
- Authorization: Bearer token
Request Body:
{
"link": "string (optional)",
"subject": "string (optional)",
"semester": "One | Two | Three | Four | Five | Six | Seven | Eight (optional)",
"isGeneral": "boolean (optional)"
}Response:
- 200 OK: Returns the updated useful link.
- 400 Bad Request: If there are validation errors or missing ID.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user doesn't have DEV role.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"id": "number",
"link": "string",
"subject": "string",
"semester": "string",
"isGeneral": "boolean"
}Delete a useful link (DEV role only).
Query Parameters:
id: ID of the useful link to delete.
Headers:
- Authorization: Bearer token
Response:
- 200 OK: Returns the deleted useful link.
- 400 Bad Request: If the ID parameter is missing.
- 401 Unauthorized: If the token is invalid or missing.
- 403 Forbidden: If the user doesn't have DEV role.
- 500 Internal Server Error: If there is an issue with the server.
Example Response:
{
"id": "number",
"link": "string",
"subject": "string",
"semester": "string",
"isGeneral": "boolean"
}Send a verification code (OTP) to a user's email. The code is stored in the database and expires after 15 minutes.
Request Body:
{
"recipientEmail": "string",
"recipientName": "string (optional)"
}Response:
- 200 OK: Returns success message.
- 400 Bad Request: If recipientEmail is missing.
- 500 Internal Server Error: If there is an issue with sending the email or the server.
Example Response:
{
"success": true,
"message": "Verification code sent successfully"
}Verify an OTP code sent to a user's email. If verification is successful and the user exists in the database, their account will be marked as verified.
Request Body:
{
"email": "string",
"otp": "string"
}Response:
- 200 OK: Returns success message if verification is successful.
- 400 Bad Request: If email or OTP is missing, invalid, expired, or not found.
- 500 Internal Server Error: If there is an issue with the server.
Example Response (Success):
{
"success": true,
"message": "Verification successful"
}Example Response (Error):
{
"success": false,
"message": "Invalid verification code"
}Reset a user's password using a verification code (OTP) previously sent to their email.
Request Body:
{
"email": "string",
"otp": "string",
"newPassword": "string"
}Response:
- 200 OK: Returns success message if the password was reset successfully.
- 400 Bad Request: If email, OTP, or new password is missing or invalid.
- 404 Not Found: If no user with the given email exists.
- 500 Internal Server Error: If there is an issue with the server.
Example Response (Success):
{
"success": true,
"message": "Password reset successful"
}Example Response (Error):
{
"success": false,
"message": "Invalid verification code"
}Notes:
- The password reset process requires first requesting a verification code via the
/api/verificationCode/sendendpoint. - The OTP must be valid and not expired.
- The new password must be at least 6 characters long.
- After a successful password reset, the verification code is deleted and cannot be reused.