https://github.com/salma-4/product-management-api
refactor from spring MVC to spring rest
https://github.com/salma-4/product-management-api
hibernate lombok maven mysql-database spring-rest swagger unit-testing
Last synced: about 1 month ago
JSON representation
refactor from spring MVC to spring rest
- Host: GitHub
- URL: https://github.com/salma-4/product-management-api
- Owner: salma-4
- Created: 2024-02-27T20:26:03.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T23:24:22.000Z (over 2 years ago)
- Last Synced: 2025-10-25T03:21:51.461Z (8 months ago)
- Topics: hibernate, lombok, maven, mysql-database, spring-rest, swagger, unit-testing
- Language: Java
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Product Management API
This project implements a RESTful API for managing product details and products. It provides endpoints to perform CRUD operations on product details and retrieve product information.
### Prerequisites
- Java 8+
- Maven
## Features
1. **Insert Product**
- Method: (POST)
- Endpoint: `/api/products`
- Request Body: ProductDetails JSON object
- Response: ProductDetails JSON object
- Example Request Body:
```json
{
"name": "",
"expirationDate": "2078-12-02",
"manufacturer": "",
"price": 10.5,
"available": true
}
2. **Update productDetails**:
- Method: PUT
- Endpoint: `/api/products`
- Request Body: ProductDetails JSON object
- Response: ProductDetails JSON object
- Example Request Body:
```json
{
"id":
"name": "",
"expirationDate": "2078-12-02",
"manufacturer": "",
"price": 10.5,
"available": true
}
3. **Delete Product **:
- Method: DELETE
- Endpoint: `/api/products?id=`
- Path Variable: ID of the product to delete
4. **Get Product Details by ID**:
- Method: GET
- Endpoint: `/api/products/productDetailsById?id=`
- Path Variable: ID of the product to retrieve
- Response: ProductDetails JSON object
5. **Get Product Details by Name**:
- Method: GET
- Endpoint: `/api/products/productDetailsByName?searchKey=`
- Query Parameter: Name of the product to retrieve
- Response: ProductDetails JSON object
6. **Get All Products**:
- Method: GET
- Endpoint: `/api/products`
- Response: List of Product JSON objects
7. **Get Product by ID**:
- Method: GET
- Endpoint: `/api/products/productById?id=`
- Path Variable: ID of the product to retrieve
- Response: Product JSON object
## Documentation
The APIs are documented using Swagger. You can access the Swagger UI by navigating to `/swagger-ui.html` after starting the application.

## Postman Collection
A Postman collection containing requests for each EndPoint , import this collection into Postman to test the APIs.

## Testing
Test cases are written using RestTemplate to ensure the functionality of the API.


### Interacting with the API
You can interact with the API using any REST client or HTTP testing tool. The API uses JSON for request and response data(Jakson).
``` jakson dependencies
com.fasterxml.jackson.core
jackson-databind
2.16.1
com.fasterxml.jackson.core
jackson-core
2.16.1