Documentation
Spring Boot personal project application with data JPA restful API, multiple role user authorization and Json Web Token (JWT) authentication
TechStack
- Kotlin
- SpringBoot
- MySQL
- Validation
- JWT
APIs
REGISTER
- Request
- Method : POST
- Endpoint :
api/v1/auth/register
- Header :
- content-type: application/json
- accept: application/json
- Body :
{ "name": "string", "email": "string", "password": "string" }
- Response
{ "code": "number", "message": "string", "data": { "access_token": "string" } }
LOGIN
- Request
- Method : POST
- Endpoint :
api/v1/auth/login
- Header :
- content-type: application/json
- accept: application/json
- Body :
{ "email": "string", "password": "string" }
- Response
{ "code": "number", "message": "string", "data": { "access_token": "string" } }
PROFILE AREA USER AND ADMIN
- Request
- Method : GET
- Endpoint :
api/v1/me
- Header :
- accept: application/json
- Authorization: Bearer
{access_token}
- Response
{ "code": "number", "message": "string", "data": { "id": "number", "name": "string", "email": "string", "role": "string" } }
ADMIN AREA
Get All Users
-
Dummy Admin Data
- email :
[email protected]
- password :
admin123
- email :
-
Request
- Method : GET
- Endpoint :
api/v1/users
- Header :
- accept: application/json
- Authorization: Bearer
{access_token}
-
Response
{ "code": "number", "message": "string", "data": [ { "id": "number", "name": "string", "email": "string", "role": "array" } ] }
Grant User As Admin
- Request
- Method : POST
- Endpoint :
api/v1/grant
- Header :
- accept: application/json
- content-type: application/json
- Authorization: Bearer
{access_token}
- Body :
{ "userId": "number" }
- Response
{ "code": "number", "message": "string", "data": null }
UnGrant User As Admin
- Request
- Method : POST
- Endpoint :
api/v1/ungrant
- Header :
- accept: application/json
- content-type: application/json
- Authorization: Bearer
{access_token}
- Body :
{ "userId": "number" }
- Response
{ "code": "number", "message": "string", "data": null }