Complete REST API reference for all microservices
All APIs are accessed through the API Gateway at
http://localhost:8080
Base URL: http://localhost:8080
Content-Type: application/json
All requests are routed through Spring Cloud Gateway
Manage customer profiles and addresses
Create a new customer
{
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"address": {
"street": "Main Street",
"houseNumber": "123",
"zipCode": "12345"
}
}
{
"id": "65f4a1b2c3d4e5f6a7b8c9d0",
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"address": {
"street": "Main Street",
"houseNumber": "123",
"zipCode": "12345"
}
}
curl -X POST http://localhost:8080/api/v1/customers \
-H "Content-Type: application/json" \
-d '{
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"address": {
"street": "Main Street",
"houseNumber": "123",
"zipCode": "12345"
}
}'
Get all customers
[
{
"id": "65f4a1b2c3d4e5f6a7b8c9d0",
"firstname": "John",
"lastname": "Doe",
"email": "john.doe@example.com",
"address": {
"street": "Main Street",
"houseNumber": "123",
"zipCode": "12345"
}
}
]
Get customer by ID
Check if customer exists
true
Browse products and manage inventory
Get all products
[
{
"id": 1,
"name": "Mechanical Gaming Keyboard",
"description": "RGB backlit mechanical keyboard with Cherry MX switches",
"availableQuantity": 50.0,
"price": 129.99,
"categoryId": 1,
"categoryName": "Keyboards",
"categoryDescription": "Computer Keyboards"
}
]
curl http://localhost:8080/api/v1/products
Get product by ID
Purchase products (reduce inventory)
[
{
"productId": 1,
"quantity": 2
},
{
"productId": 2,
"quantity": 1
}
]
[
{
"productId": 1,
"name": "Mechanical Gaming Keyboard",
"description": "RGB backlit mechanical keyboard",
"price": 129.99,
"quantity": 2
}
]
Place and manage orders
Create a new order
This endpoint orchestrates the complete order flow: validates customer, purchases products, processes payment, and sends notifications via Kafka
{
"customerId": "65f4a1b2c3d4e5f6a7b8c9d0",
"paymentMethod": "CREDIT_CARD",
"products": [
{
"productId": 1,
"quantity": 2
},
{
"productId": 5,
"quantity": 1
}
]
}
CREDIT_CARDDEBIT_CARDPAYPALUPI{
"id": 1,
"reference": "ORD-2024-001",
"totalAmount": 389.97,
"paymentMethod": "CREDIT_CARD",
"customerId": "65f4a1b2c3d4e5f6a7b8c9d0"
}
curl -X POST http://localhost:8080/api/v1/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": "65f4a1b2c3d4e5f6a7b8c9d0",
"paymentMethod": "CREDIT_CARD",
"products": [
{
"productId": 1,
"quantity": 2
}
]
}'
After successful order creation, you'll receive order confirmation and payment confirmation emails in MailDev (http://localhost:1080)
Get order by ID
Payment processing is handled automatically by the Order Service. No direct API calls needed.
The Payment Service is called internally by the Order Service via OpenFeign. It publishes payment confirmation events to Kafka.
Notifications are sent automatically via Kafka events. No direct API calls needed.
The Notification Service consumes Kafka events and sends HTML emails. Check MailDev at http://localhost:1080 to view sent emails.
http://localhost:8082
View all registered serviceshttp://localhost:9411
Distributed request tracing/actuator/health
Check service healthhttp://localhost:1080
Email testing interfacecurl http://localhost:8081/actuator/health
curl http://localhost:8080/actuator/health
Invalid request body or missing required fields
{
"timestamp": "2024-03-15T10:30:00",
"status": 400,
"error": "Bad Request",
"message": "Validation failed",
"path": "/api/v1/customers"
}
Resource not found
{
"timestamp": "2024-03-15T10:30:00",
"status": 404,
"error": "Not Found",
"message": "Customer not found with id: 123",
"path": "/api/v1/customers/123"
}
Server error occurred
{
"timestamp": "2024-03-15T10:30:00",
"status": 500,
"error": "Internal Server Error",
"message": "An unexpected error occurred",
"path": "/api/v1/orders"
}
Step-by-step example of creating a complete order
curl -X POST http://localhost:8080/api/v1/customers \
-H "Content-Type: application/json" \
-d '{
"firstname": "Jane",
"lastname": "Smith",
"email": "jane.smith@example.com",
"address": {
"street": "Oak Avenue",
"houseNumber": "456",
"zipCode": "67890"
}
}'
Save the returned customer ID for the next step
curl http://localhost:8080/api/v1/products
Note the product IDs you want to order
curl -X POST http://localhost:8080/api/v1/orders \
-H "Content-Type: application/json" \
-d '{
"customerId": "YOUR_CUSTOMER_ID_HERE",
"paymentMethod": "CREDIT_CARD",
"products": [
{
"productId": 1,
"quantity": 2
},
{
"productId": 5,
"quantity": 1
}
]
}'