🛍️ E-Commerce API Documentation

Welcome to our comprehensive e-commerce API

Server: 🟢 Online
Database: 🟢 Connected
Version: 1.0.0

🔐 Authentication

User authentication and authorization endpoints

POST /auth/sign_up
Register a new user account
{ "email": "user@example.com", "password": "password123", "name": "John Doe" }
POST /auth/sign_in
Login with existing credentials
{ "email": "user@example.com", "password": "password123" }

👥 Users Management

User profile and management endpoints

GET /users
Get all users (Admin only)
Bearer Token Required
PUT /users/:id
Update user profile
Bearer Token Required
{ "name": "Updated Name", "email": "updated@example.com" }
Params: { "id": "User ID" }

📂 Category

Product categories management

GET /category
Get all product categories
POST /category
Create a new category
Admin Token Required
{ "name": "Electronics", "description": "Electronic devices and accessories" }
PUT /category/:id
Update category
Admin Token Required
Params: { "id": "Category ID" }
DELETE /category/:id
Delete category
Admin Token Required
Params: { "id": "Category ID" }

🛒 Products Management

Product catalog and management endpoints

POST /products/create
Create a new product
Admin Token Required
{ "title": "Casual T-Shirt", "price": 199, "cat_prefix": "684a04ee75ff1f474e1a2b86", "img": "https://images.pexels.com/photos/1468372/pexels-photo-1468372.jpeg", "max": 4, "owner": "684c645fd216bfe3cab3eed8" }
GET /products
Get all products
No authentication required
GET /products/:id
Get a specific product by ID
No authentication required
Params: { "id": "Product ID" }
GET /products/owner/:owner
Get all products by owner/seller
No authentication required
Params: { "owner": "Owner/User ID" }
GET /products/category/:cat_prefix
Get all products in a specific category
No authentication required
Params: { "cat_prefix": "Category ID" }
GET /products/search/:title
Search products by title
No authentication required
Params: { "title": "Product title or keyword" }

🛒 Cart Management

Shopping cart operations

GET /cart
Get all carts
Admin Token Required
GET /cart/:ownerId
Get cart by owner ID
No authentication required
Params: { "ownerId": "Owner ID" }
POST /cart/add
Add a product to the cart
No authentication required
{ "productId": "Product ID", "quantity": 1 }
DELETE /cart/delete/:id
Delete a cart by ID
No authentication required
Params: { "id": "Cart ID" }
PUT /cart/update
Update a cart
No authentication required
GET /cart/getByOwner/:ownerId
Get cart by owner ID
No authentication required
Params: { "ownerId": "Owner ID" }
GET /cart/getByProduct/:productId
Get cart by product ID
No authentication required
Params: { "productId": "Product ID" }
GET /cart/getByOwnerAndProduct/:ownerId/:productId
Get cart by owner ID and product ID
No authentication required
Params: { "ownerId": "Owner ID", "productId": "Product ID" }
GET /cart/getByOwnerAndProduct/:ownerId/:productId
Get cart by owner ID and product ID
No authentication required
Params: { "ownerId": "Owner ID", "productId": "Product ID" }
GET /cart/getByOwnerAndProduct/:ownerId/:productId
Get cart by owner ID and product ID
No authentication required
Params: { "ownerId": "Owner ID", "productId": "Product ID" }