This document provides a comprehensive technical reference for the RESTful APIs exposed by the Observable Microservices E-Commerce platform. All external communication is routed through a central API Gateway.
All requests must be prefixed with the API Gateway host and the versioned path.
Base Path: http://localhost:8080/api/v1
The system uses JSON Web Tokens (JWT) for authentication. Tokens are obtained via the Authentication Service and must be included in the Authorization header for all protected endpoints.
Header Format:
Authorization: Bearer <your_jwt_token>The API Gateway enforces the following headers on all responses:
X-Gateway-Source: api-gatewayX-Content-Type-Options: nosniff
All endpoints natively support Cross-Origin Resource Sharing (CORS).
Path Prefix: /auth
Method: POST | Path: /register | Security: Public
Request Body:
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"password": "SecurePassword123!",
"phone": "+1234567890"
}Response (201 Created):
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIi...",
"type": "Bearer",
"user": {
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"role": "USER"
}
}Method: POST | Path: /login | Security: Public
Request Body:
{
"email": "john.doe@example.com",
"password": "SecurePassword123!"
}Response (200 OK):
{
"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIi...",
"type": "Bearer",
"user": {
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"role": "USER"
}
}Path Prefix: /users
Method: GET | Path: /me | Security: Authenticated
Response (200 OK):
{
"id": 1,
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"phone": "+1234567890",
"role": "USER"
}Method: PATCH | Path: /me | Security: Authenticated
Request Body:
{
"firstName": "Johnny",
"lastName": "Smith",
"phone": "+1987654321"
}Response (200 OK):
{
"id": 1,
"firstName": "Johnny",
"lastName": "Smith",
"email": "john.doe@example.com",
"phone": "+1987654321",
"role": "USER"
}Path Prefix: /products and /categories
Method: POST | Path: /categories | Security: Authenticated
Request Body:
{
"name": "Electronics",
"description": "Electronic gadgets and devices"
}Response (201 Created):
{
"id": 1,
"name": "Electronics",
"description": "Electronic gadgets and devices",
"active": true
}Method: POST | Path: /products | Security: Authenticated
Request Body:
{
"name": "Gaming Laptop",
"sku": "LAP-001",
"price": 1499.99,
"stockQuantity": 50,
"categoryId": 1
}Response (201 Created):
{
"id": 1,
"sku": "LAP-001",
"name": "Gaming Laptop",
"description": null,
"price": 1499.99,
"stockQuantity": 50,
"active": true,
"category": {
"id": 1,
"name": "Electronics",
"description": "Electronic gadgets and devices",
"active": true
},
"createdAt": "2026-03-01T12:00:00Z",
"updatedAt": "2026-03-01T12:00:00Z"
}Method: PATCH | Path: /products/{id}/inventory | Security: Authenticated
Request Body:
{
"quantity": 10,
"operation": "ADD"
}(Valid operations: ADD, SUBTRACT, SET)
Response (200 OK):
{
"id": 1,
"sku": "LAP-001",
"name": "Gaming Laptop",
"price": 1499.99,
"stockQuantity": 60,
"active": true,
"category": {
"id": 1,
"name": "Electronics"
}
}Method: GET | Path: /products | Security: Authenticated
Response (200 OK):
{
"content": [
{
"id": 1,
"sku": "LAP-001",
"name": "Gaming Laptop",
"price": 1499.99,
"stockQuantity": 60,
"active": true,
"category": {
"id": 1,
"name": "Electronics"
}
}
],
"pageable": {
"pageNumber": 0,
"pageSize": 20
},
"totalElements": 1,
"totalPages": 1
}Path Prefix: /cart
Method: POST | Path: /cart/items | Security: Authenticated
Request Body:
{
"productId": 1,
"quantity": 2
}Response (200 OK):
{
"id": 1,
"userId": 1,
"totalPrice": 2999.98,
"items": [
{
"id": 1,
"productId": 1,
"productName": "Gaming Laptop",
"sku": "LAP-001",
"price": 1499.99,
"quantity": 2,
"subTotal": 2999.98
}
]
}Method: PATCH | Path: /cart/items/{itemId} | Security: Authenticated
Request Body:
{
"quantity": 3
}Response (200 OK):
{
"id": 1,
"userId": 1,
"totalPrice": 4499.97,
"items": [
{
"id": 1,
"productId": 1,
"productName": "Gaming Laptop",
"sku": "LAP-001",
"price": 1499.99,
"quantity": 3,
"subTotal": 4499.97
}
]
}Path Prefix: /orders
Method: POST | Path: /orders | Security: Authenticated
Request Body:
{
"userId": 1,
"shippingAddress": "123 Main St, Tech City, ST 12345",
"paymentMethod": "CREDIT_CARD",
"items": [
{
"productId": 1,
"quantity": 2
}
]
}Response (201 Created):
{
"id": 1,
"userId": 1,
"status": "CONFIRMED",
"totalAmount": 2999.98,
"shippingAddress": "123 Main St, Tech City, ST 12345",
"paymentMethod": "CREDIT_CARD",
"paymentTxnId": "txn_8f7d6a5b",
"items": [
{
"id": 1,
"productId": 1,
"productName": "Gaming Laptop",
"sku": "LAP-001",
"price": 1499.99,
"quantity": 2
}
],
"createdAt": "2026-03-01T12:05:00Z",
"updatedAt": "2026-03-01T12:05:05Z"
}Method: GET | Path: /orders/{id} | Security: Authenticated
Response (200 OK): (Matches the Create Order response body format)
Path Prefix: /payments
Method: POST | Path: /payments/charge | Security: Authenticated (System Internal Call Typically)
Request Body:
{
"orderId": 1,
"amount": 2999.98,
"currency": "USD",
"method": "CREDIT_CARD",
"userId": 1
}Response (201 Created):
{
"id": 1,
"transactionId": "txn_8f7d6a5b",
"orderId": 1,
"amount": 2999.98,
"currency": "USD",
"status": "SUCCESS",
"method": "CREDIT_CARD",
"message": "Payment processed successfully"
}Path Prefix: /notifications
Method: POST | Path: /notifications/send | Security: Authenticated (System Internal Call Typically)
Request Body:
{
"recipient": "john.doe@example.com",
"subject": "Order Confirmation - Order #1",
"content": "Your order has been successfully placed. Total: $2999.98",
"type": "EMAIL",
"referenceId": 1
}Response (201 Created):
{
"id": 1,
"recipient": "john.doe@example.com",
"subject": "Order Confirmation - Order #1",
"content": "Your order has been successfully placed. Total: $2999.98",
"type": "EMAIL",
"status": "SENT",
"referenceId": 1,
"sentAt": "2026-03-01T12:05:06Z"
}