Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

A Spring Boot based coding assignment for Java developers

Notifications You must be signed in to change notification settings

GFG/short-coding-assignment-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Local Setup

Clone and open the project in your IDE. Run the main class ProductApplication as spring boot application. On startup spring boot will read the data.sql file and execute the contents.

The Product Service is now ready to receive API requests.

REST API Documentation for Products

Find All Products

Send a GET Request to http://localhost:8080/products

Find a Product with Id 1

Send a GET Request to http://localhost:8080/products/1

Add New Product

Send a POST request to http://localhost:8080/products

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 PATCH request to http://localhost:8080/products/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 DELETE request to http://localhost:8080/products/1

Since the DELETE operation is idempotent, it will return a 204 when the resource is deleted, or it does not exist.

About

A Spring Boot based coding assignment for Java developers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages