This project responds to the following http GET and PUT requests to deliver product data as JSON or update a product’s price in the database.
Delivers product data as JSON.
** URL: /api/v1/products/{id}
** URL Params: id
** Example:
* URL: /api/v1/products/13860428
* Response: {"id":13860428,"name":"The Big Lebowski (Blu-ray)","current_price":{"value":16.65,"currencycode":"USD"}}
Updates a product’s price in the database.
** URL: /api/v1/products/{id}
** URL Params: id
** Request body: JSON, similar to the GET response
** Example:
* URL: /api/v1/products/13860428
* Request body: {"id":13860428,"name":"The Big Lebowski (Blu-ray)","current_price":{"value":29.50,"currencycode":"USD"}}
- id : number, null not allowed
- name : string, null allowed
- value : number, price format (e.g.: 10.25, 100, 99.99, 0.75), null not allowed
- currency_code : "USD" (string, case sensitive), null not allowed
- 200 OK : Product is found/updated
- 404 Not Found: Product is not found in database
- 304 Not modified: Product price is not updated
- 400 Bad request: URL/request body has incorrect format
- Maven is installed
- Cassandra is installed
Tomcat server port is set to 8014. This can be changed in resources/config/application.properties file.
Once application is running, the following options can be used to request the endpoint
- Advanced REST Client
- Postman
- Clone the code to your local repository from https://github.com/AlarkaSanyal/products-api-services
- Open a terminal window and cd to the application parent folder
- Run the following command
...\products-api-services>mvn clean package
- Run the executable jar from target folder
\products-api-services>java -jar target\products-api-services-1.0-SNAPSHOT.jar
- Clone the code to your local repository from https://github.com/AlarkaSanyal/products-api-services
- Open a terminal window and cd to the application parent folder
- Run the following command
...\products-api-services>mvn spring-boot:run
- Clone the code to your local repository from https://github.com/AlarkaSanyal/products-api-services
- Open Eclipse/STS
- Import the project
- Right-click on the project and "Run" as a "Spring Boot App"
- Clone the code to your local repository from https://github.com/AlarkaSanyal/products-api-services
- Open Eclipse/STS
- Import the project
- Right-click on the project and "Run" as a "JUnit Test"