Simples CRUD application using Java and Spring Boot
Login is required to use the APIs. A JWT token is automatically assigned to the user upon successful login, and all subsequent requests are processed only if the token is found. Otherwise, the server will return a 403 response.
The system has 4 main API routes
- "/login"
- "api/v1/management/**"
- "api/v1/students/**"
- "signup/student"
Login
POST - "/login"
{
"username": "superadmin",
"password": "123456"
}
{
"username": "admin",
"password": "1234567"
}
{
".......": "......"
}
Management
"api/management/**" - only system admins can use this path. You can access the API paths available in the system and make requests to them
Working with Users table.
POST - "api/v1/management/users/create"
Authorization - "jwt_token"
{
"username": "....",
"password": "...."
}
POST - "api/v1/management/users/enable/{id}"
POST - "api/v1/management/users/disable/{id}"
Working with Student table
GET - "api/v1/management/students"
GET - "api/v1/management/students/{id}"
GET - "api/v1/management/students/by?name=..."
Param name = "..."
Working with Faculty table
POST - "api/v1/management/faculties"
{
"name": "....."
}
GET - "api/v1/management/faculties"
GET - "api/v1/management/faculties/{id}"DELETE - "api/v1/management/faculties/{id}"
PUT - "api/v1/management/faculties/{id}"
{
"name": "....."
}
Working with Roles table
POST - "api/v1/management/roles"
{
"name": "ROLE_NAME"
}
POST - "api/v1/management/roles/assign/{user_id}"
{
"id": ...
}
DELETE - "api/v1/management/roles/remove/{user_id}"
{
"id": ...
}
GET - "api/v1/management/roles"
GET - "api/v1/management/roles/{role_id}"
DELETE - "api/v1/management/roles/{role_id}"
PUT - "api/v1/management/roles/{role_id}"
Students
"api/v1/students/**" - With this API, students can get their data, change it and launch their account.
PUT - "api/v1/students/{id}"
{
"firstname": "Firstname",
"lastname": "Lastname",
"birth_date": "1990-01-01",
"address": "22 Galaxy"
}
GET - "api/v1/students/{id}"
DELETE - "api/v1/students/{id}"
Sign UP
"signup/student" - This API is open to everyone for student registration.
POST - "signup/student"{
"username": "....",
"password": "....",
"firstname": "....",
"lastname": "....",
"birth_date": "....",
"faculty": ....,
"address": "...."
}
Dependencies tree
|_ _ _ spring-boot-starter-data-jpa
|
|_ _ _ spring-boot-starter-security
|
|_ _ _ jjwt-api
|
|_ _ _ postgresql
|
|_ _ _ projectlombok
|
|_ _ _ spring-boot-starter-test
|
|_ _ _ spring-boot-starter-web