PromoCodes is an application to manage discount codes for sales or promotions
Run file PromoCodesApplication.
Use an HTTP client to test the API (for example Postman).
The initial URL is http://localhost:8080.
For further HTTP requests, add the necessary commands to the initial URL address.
{ "name": "Blueberries", "price": 50.99, "currency": "PLN", "description": "A kilo of blueberries" }
Method POST
To add a product enter /api/products.
To apply a promo code to a product, enter /api/products/{id}/{promocode} ({id} - product identifier, {promocode} - promo code name).
Method PUT
To change product parameters enter /api/products/{id}.
Method GET
To get all existing products enter /api/products.
To get a particular product enter /api/products/{id}.
{ "code": "SUMMER2024", "discountAmount": 25.55, "expirationDate": "2024-07-01T11:06:18", "currency": "PLN", "maxUsages": 3 }
Method POST
To add a promo code enter /api/promocodes.
Method GET
To get all existing promo codes enter /api/promocodes.
To get a particular promo code enter /api/promocodes/{promocode} ({promocode} - promo code name).
Method POST
To simulate a purchase with using promo code enter /api/purchase/{id}/{promocode} ({id} - product identifier, {promocode} - promo code name).
To simulate a purchase without using promo code enter /api/purchase/{id}.
Method GET
To get all existing purchases enter /api/purchase.