This is a simple loan API demo that allows you to create, read, update and delete loans. It is built with H2 in-memory database, Spring Boot, Spring Data JPA, and Spring Web. You can access the database console at http://localhost:8080/h2-console with the following credentials: username: sa and password: password_loan
Ensure you have the following installed:
- Java 17 or higher
- Maven (for building and running the project)
git clone https://github.com/username/user-management-api.git
cd user-management-api
mvn clean install
mvn spring-boot:run
The application will be available at http://localhost:8080
.
HTTP Method | Endpoint | Description | RequiredRole |
---|---|---|---|
GET |
/customers |
Get all customers | Admin |
GET |
/customers/{id} |
Get a customer by ID | Admin, User |
POST |
/customers |
Create a new customer | Admin |
PUT |
/customers/{id} |
Update customer information | Admin, User |
DELETE |
/customers/{id} |
Delete a customer by ID | Admin |
POST |
/customers/{id}/loans |
Create a new loan | Admin, User |
GET |
/customers/{id}/loans |
Get all loans by customer ID | Admin, User |
GET |
/customers/{id}/loans/{loanId}/installments |
Get all loans by loan ID | Admin, User |
POST |
/customers/{id}/loans/{loanId}/installments/pay |
Pay Loan | Admin, User |
Admin username and admin password are both 'admin'. You can access the endpoints with these as admin by using Basic Auth You can also add a new customer as admin. And use the endpoints for that user as the user's oneself.