Clone and open the project in your IDE. Run the main class ProductServiceApplication as spring boot appllication. On startup spring boot will read the data.sql file and execute the contents.
The Product Service is now ready to receive API requests.
Find All Products
Send a POST
Request to http://localhost:8080/products/findAll
Find a Product with Id 1
Send a POST
Request to http://localhost:8080/products/findById/1
Add New Product
Send a POST
request to http://localhost:8080/products/new
Sample Request Body
{
"productId": "LEVIS12345",
"title": "Jeans",
"description": "Regular fit jeans",
"brand": "LEVIS",
"price": 12000.00,
"color": "Black"
}
Update a Product with Id 1
Send a POST
request to http://localhost:8080/products/updateById/1
Sample Request Body
{
"price": 20000.00,
"color": "BLUE"
}
Response
{
"id": 1,
"productId": "LEVIS12345",
"title": "Jeans",
"description": "Regular fit jeans",
"brand": "LEVIS",
"price": 20000.00,
"color": "BLUE"
}
Delete a Product with Id 1
Send a POST
request to http://localhost:8080/products/deleteById/1
If delete is successful true
is returned in response, if failed then false
is returned