Products
List All Products
curl -X GET "${VITE_BASE_URL}/product" \
-H "Authorization: Bearer <token>"
Retrieves a list of all products.
Authentication Required: Yes
Response
Array of product objectsProduct unique identifier
Available colors for the product
Available sizes for the product
{
"data": [
{
"id": 1,
"name": "T-Shirt Premium",
"description": "High quality cotton t-shirt",
"price": 299.99,
"category_id": 1,
"images": [
{
"id": 1,
"url": "https://example.com/image.jpg",
"is_primary": true
}
],
"colors": ["Red", "Blue", "Green"],
"sizes": ["S", "M", "L", "XL"]
}
]
}
Get Product by ID
curl -X GET "${VITE_BASE_URL}/product/1" \
-H "Authorization: Bearer <token>"
Retrieves a single product by its ID.
Authentication Required: Yes
Path Parameters
Response
Product unique identifier
Create Product
curl -X POST "${VITE_BASE_URL}/product" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "name=New Product" \
-F "description=Product description" \
-F "price=499.99" \
-F "category_id=1" \
-F "images[]=@/path/to/image1.jpg" \
-F "images[]=@/path/to/image2.jpg"
Creates a new product with images.
Authentication Required: Yes
Content-Type: multipart/form-data
Request Body
Response
Update Product
curl -X PUT "${VITE_BASE_URL}/product/1" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: multipart/form-data" \
-F "name=Updated Product" \
-F "price=599.99"
Updates an existing product.
Authentication Required: Yes
Content-Type: multipart/form-data
Path Parameters
Request Body
Same fields as Create Product (all optional for updates)
Delete Product
curl -X DELETE "${VITE_BASE_URL}/product/1" \
-H "Authorization: Bearer <token>"
Deletes a product.
Authentication Required: Yes
Path Parameters
Product Images
Set Primary Image
curl -X PUT "${VITE_BASE_URL}/product_image/5/primary" \
-H "Authorization: Bearer <token>"
Sets an image as the primary image for a product.
Authentication Required: Yes
Path Parameters
Delete Product Image
curl -X DELETE "${VITE_BASE_URL}/product_image/5" \
-H "Authorization: Bearer <token>"
Deletes a product image.
Authentication Required: Yes
Path Parameters
Categories
List All Categories
curl -X GET "${VITE_BASE_URL}/product_category" \
-H "Authorization: Bearer <token>"
Retrieves all product categories.
Authentication Required: Yes
Get Category by ID
curl -X GET "${VITE_BASE_URL}/product_category/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Path Parameters
Create Category
curl -X POST "${VITE_BASE_URL}/product_category" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "New Category",
"description": "Category description"
}'
Creates a new product category.
Authentication Required: Yes
Request Body
Update Category
curl -X PUT "${VITE_BASE_URL}/product_category/1" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "Updated Category"}'
Authentication Required: Yes
Path Parameters
Delete Category
curl -X DELETE "${VITE_BASE_URL}/product_category/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Path Parameters
Colors
List All Colors
curl -X GET "${VITE_BASE_URL}/product_color" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Get Color by ID
curl -X GET "${VITE_BASE_URL}/product_color/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Create Color
curl -X POST "${VITE_BASE_URL}/product_color" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "Navy Blue", "hex": "#001f3f"}'
Authentication Required: Yes
Request Body
Hex color code (e.g., #FF0000)
Update Color
curl -X PUT "${VITE_BASE_URL}/product_color/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Delete Color
curl -X DELETE "${VITE_BASE_URL}/product_color/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Sizes
List All Sizes
curl -X GET "${VITE_BASE_URL}/product_size" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Get Size by ID
curl -X GET "${VITE_BASE_URL}/product_size/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Create Size
curl -X POST "${VITE_BASE_URL}/product_size" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "XXL", "code": "XXL"}'
Authentication Required: Yes
Request Body
Size code (e.g., S, M, L, XL)
Update Size
curl -X PUT "${VITE_BASE_URL}/product_size/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes
Delete Size
curl -X DELETE "${VITE_BASE_URL}/product_size/1" \
-H "Authorization: Bearer <token>"
Authentication Required: Yes