This repository contains a Java EE API for a Point of Sale (POS) system. The API provides endpoints for managing customers, items, and orders.
- Java EE
- JNDI
- Servlets
- ObjectMapper (Jackson library)
- URL: http://localhost:8080/pos/customer
- Method: GET
- Description: Retrieve a list of all customers.
- URL: http://localhost:8080/pos/customer?customerId={id}
- Method: GET
- Description: Retrieve customer details by ID.
- URL: http://localhost:8080/pos/customer
- Method: POST
- Description: Add a new customer.
- Request Body: JSON representing the customer.
- URL: http://localhost:8080/pos/customer
- Method: PUT
- Description: Update an existing customer.
- Request Body: JSON representing the updated customer.
- URL: http://localhost:8080/pos/customer?customerId={id}
- Method: DELETE
- Description: Delete a customer by ID.
- URL: http://localhost:8080/pos/item
- Method: GET
- Description: Retrieve a list of all items.
- URL: http://localhost:8080/pos/item?itemCode={code}
- Method: GET
- Description: Retrieve item details by code.
- URL: http://localhost:8080/pos/item
- Method: POST
- Description: Add a new item.
- Request Body: JSON representing the item.
- URL: http://localhost:8080/pos/item
- Method: PUT
- Description: Update an existing item.
- Request Body: JSON representing the updated item.
- URL: http://localhost:8080/pos/item?itemCode={code}
- Method: DELETE
- Description: Delete an item by code.
- URL: http://localhost:8080/pos/order
- Method: GET
- Description: Retrieve a list of all orders.
- URL: http://localhost:8080/pos/order?orderId={id}
- Method: GET
- Description: Retrieve order details by ID.
- URL: http://localhost:8080/pos/order
- Method: POST
- Description: Add a new order.
- Request Body: JSON representing the order.
- URL: http://localhost:8080/pos/order
- Method: PUT
- Description: Update an existing order.
- Request Body: JSON representing the updated order.
- URL: http://localhost:8080/pos/order?orderId={id}
- Method: DELETE
- Description: Delete an order by ID.
You can use Postman to interact with the API. Follow these steps:
- Open Postman.
- Choose the appropriate HTTP method (GET, POST, PUT, DELETE).
- Enter the corresponding API endpoint URL.
- Set the request body to JSON format when required.
- Send the request.
{
"customerId": "C001",
"customerName": "Danidu",
"address": "Horana",
"salary": "150000"
}
{
"itemCode": "I001",
"itemName": "Rice packet",
"qty": 45,
"price": 800
}