All API requests go through the API Gateway at http://localhost:9090
- API Gateway:
http://localhost:9090 - User Service:
http://localhost:8089(via gateway:/auth/**,/users/**) - Product Catalog:
http://localhost:8082(via gateway:/api/products/**) - Cart Service:
http://localhost:8085(via gateway:/cart/**,/checkout/**) - Order Management:
http://localhost:8084(via gateway:/api/orders/**)
Register a new user account.
Request Body:
{
"email": "user@example.com",
"phone": "+1234567890",
"password": "securePassword123",
"name": "John Doe"
}Response:
{
"id": 1,
"email": "user@example.com",
"phone": "+1234567890",
"name": "John Doe",
"addresses": [],
"paymentMethods": [],
"orders": [],
"wishlist": []
}Authenticate user credentials.
Request Body:
{
"identifier": "user@example.com", // email or phone
"password": "securePassword123"
}Response:
{
"id": 1,
"email": "user@example.com",
"phone": "+1234567890",
"name": "John Doe",
"addresses": [...],
"paymentMethods": [...],
"orders": [...],
"wishlist": [...]
}Verify OTP for phone number verification.
Request Body:
{
"phone": "+1234567890",
"otp": "123456"
}Get all addresses for a user.
Response:
[
{
"id": 1,
"fullName": "John Doe",
"phone": "+1234567890",
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "USA",
"isDefault": true
}
]Add a new address for a user.
Request Body:
{
"fullName": "John Doe",
"phone": "+1234567890",
"line1": "123 Main St",
"line2": "Apt 4B",
"city": "New York",
"state": "NY",
"postalCode": "10001",
"country": "USA",
"isDefault": false
}Get all payment methods for a user.
Response:
[
{
"id": 1,
"provider": "VISA",
"token": "card_1234567890_4242",
"isDefault": true,
"createdAt": "2024-01-15T10:30:00Z"
}
]Add a new payment method.
Request Body:
{
"provider": "VISA",
"token": "card_1234567890_4242"
}Get user's wishlist.
Response:
[
{
"id": 1,
"userId": 1,
"productId": 5,
"createdAt": "2024-01-15T10:30:00Z"
}
]Add product to wishlist.
Request Body:
{
"productId": 5
}Remove product from wishlist.
Get all products with full details.
Response:
[
{
"id": 1,
"sku": "SKU-APL-IP15PM",
"name": "Apple iPhone 15 Pro Max",
"brand": "Apple",
"description": "A17 Pro chip, Titanium body, Pro camera system",
"price": 134999.00,
"currency": "INR",
"stock": 44,
"availabilityStatus": "IN_STOCK",
"specifications": {
"Storage": "256GB",
"Color": "Natural Titanium"
},
"categories": ["Electronics"],
"imageUrls": [
"https://images.unsplash.com/photo-1720357632099-6d84cd7ee044..."
],
"averageRating": 4.5,
"reviewCount": 128,
"reviews": [...]
}
]Get a specific product by ID.
Response: Same as single product object above.
Reduce product stock (used during order processing).
Query Parameters:
quantity(required): Number of items to reduce
Response:
"Stock reduced successfully"Check if sufficient stock is available.
Query Parameters:
quantity(required): Quantity to check
Response:
true // or falseUpload product image.
Request: Multipart file upload
Response:
"Image uploaded successfully"Get product image by ID.
Response: Binary image data
Get all reviews for a product.
Response:
[
{
"id": 1,
"userId": 1001,
"userName": "John Doe",
"userAvatar": null,
"rating": 5,
"title": "Amazing phone",
"comment": "Love the new titanium design and camera quality.",
"verifiedPurchase": true,
"helpfulCount": 234,
"createdAt": "2024-01-15T10:12:00Z"
}
]Create a new review.
Request Body:
{
"userId": 1,
"userName": "John Doe",
"rating": 5,
"title": "Great product",
"comment": "Highly recommended!",
"verifiedPurchase": true
}Get user's cart with all items.
Response:
{
"id": 1,
"userId": 1,
"items": [
{
"id": 10,
"productId": 2,
"quantity": 1,
"variant": null
}
],
"updatedAt": "2024-01-15T10:30:00Z"
}Add item to cart.
Query Parameters:
productId(required): Product ID to addquantity(required): Quantity to addvariant(optional): Product variant
Response: Updated cart object
Update cart item quantity.
Query Parameters:
quantity(required): New quantity
Response: Updated cart object
Remove item from cart.
Response: Updated cart object
Get cart pricing details.
Response:
{
"subtotal": 134999.00,
"tax": 24299.82,
"shipping": 0.00,
"discount": 0.00,
"grandTotal": 159298.82
}Process checkout and create order.
Query Parameters:
userId(required): User IDaddressId(required): Shipping address IDshipping(optional): Shipping method (default: "STANDARD")method(required): Payment method
Response:
{
"order": {
"orderId": "ORD-1234567890",
"status": "PENDING",
"totalAmount": 159298.82
},
"payment": {
"intentId": "pi_1234567890",
"status": "confirmed"
},
"message": "Order placed successfully!"
}Create a new order (used by frontend).
Request Body:
{
"userId": 1,
"customerId": 1,
"items": [
{
"productId": 1,
"productName": "Apple iPhone 15 Pro Max",
"productImage": "https://...",
"quantity": 1,
"price": 134999.00,
"total": 134999.00
}
],
"subtotal": 134999.00,
"shipping": 0.00,
"tax": 24299.82,
"discount": 0.00,
"total": 159298.82,
"shippingAddress": {
"fullName": "John Doe",
"phone": "+1234567890",
"addressLine1": "123 Main St",
"city": "New York",
"state": "NY",
"zipCode": "10001",
"country": "USA"
},
"paymentMethod": {
"type": "card",
"cardNumber": "**** **** **** 4242",
"cardHolder": "John Doe"
}
}Response:
{
"id": "ORD-1234567890",
"date": "2024-01-15T10:30:00Z",
"status": "pending",
"items": [...],
"subtotal": 134999.00,
"shipping": 0.00,
"tax": 24299.82,
"discount": 0.00,
"total": 159298.82,
"shippingAddress": {...},
"paymentMethod": {...},
"trackingNumber": "",
"estimatedDelivery": "2024-01-22"
}Get order details by order ID.
Response: Same as order object above.
Get all orders for a user.
Response: Array of order objects.
Update order details.
Request Body: Updated order object
Cancel an order.
Response:
"Order cancelled successfully"Track order status.
Response: Order object with current status.
Create order from cart service (legacy).
Request Body:
{
"userId": 1,
"addressId": 1,
"shippingOption": "standard",
"amount": 159298.82,
"items": [
{
"productId": 1,
"quantity": 1,
"unitPrice": 134999.00,
"lineTotal": 134999.00
}
]
}{
"status": "success",
"data": {...},
"message": "Operation completed successfully"
}{
"status": "error",
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
{
"field": "email",
"message": "Email is required"
}
]
},
"timestamp": "2024-01-15T10:30:00Z"
}| Code | Description |
|---|---|
| 200 | OK - Request successful |
| 201 | Created - Resource created successfully |
| 400 | Bad Request - Invalid input data |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Access denied |
| 404 | Not Found - Resource not found |
| 409 | Conflict - Resource already exists |
| 500 | Internal Server Error - Server error |
- Type: localStorage-based session
- Token: Simple string stored in browser
- Validation: Client-side only (no server validation)
Content-Type: application/json
Accept: application/jsonAuthorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...- No rate limiting implemented
- All endpoints accept unlimited requests
- Authentication: 5 requests/minute per IP
- Product Catalog: 100 requests/minute per user
- Cart Operations: 50 requests/minute per user
- Order Creation: 10 requests/minute per user
curl -X POST http://localhost:9090/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"phone": "+1234567890",
"password": "password123",
"name": "Test User"
}'curl -X GET http://localhost:9090/api/products \
-H "Accept: application/json"curl -X POST "http://localhost:9090/cart/1/items?productId=1&quantity=2" \
-H "Content-Type: application/json"- Import the API collection (can be generated from this documentation)
- Set base URL to
http://localhost:9090 - Configure environment variables for user IDs and tokens
This API documentation provides comprehensive coverage of all endpoints available in the e-commerce microservices platform. Each endpoint includes request/response examples and proper HTTP status codes for effective integration and testing.