Danso Textile E-commerce API

Complete REST API documentation for developers

18 Public Endpoints
29 Protected Endpoints
23 Admin Endpoints

Authentication

User registration, login, and token management

POST /api/register
Register a new user account. Returns user data and access token for immediate authentication.
Public Endpoint
POST /api/login
Authenticate user credentials and receive access token for API authorization.
Public Endpoint
POST /api/logout
Logout user and invalidate the current access token.
Auth Required
GET /api/user
Get current authenticated user information.
Auth Required

Products

Product catalog management and browsing

GET /api/products
Get paginated list of products.
Public
GET /api/products
Response:
[
  {
    "id": "b7e3f0b0-5e6f-4d42-85c1-2c5f71f98f6a",
    "name": "Men's Running Shoes",
    "sku": "MRS-001",
    "price": 79.99,
    "stock_quantity": 120,
    "status": "published"
  }
]
GET /api/products/{product}
Get detailed product info.
Public
GET /api/products/b7e3f0b0-5e6f-4d42-85c1-2c5f71f98f6a
Response:
{
  "id": "b7e3f0b0-5e6f-4d42-85c1-2c5f71f98f6a",
  "name": "Men's Running Shoes",
  "sku": "MRS-001",
  "price": 79.99,
  "stock_quantity": 120,
  "variants": [
    { "id": "v1a2b3c4-d5e6-4f7a-8b9c-1a2d3e4f5b6c", "size": "8", "color": "Black" }
  ]
}
POST /api/products
Create new product (Admin).
Admin
POST /api/products
Request:
{
  "name": "Bluetooth Speaker",
  "sku": "BS-101",
  "price": 59.99,
  "stock_quantity": 100
}
Response:
{
  "message": "Product created successfully",
  "product": { "id": "a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j", "name": "Bluetooth Speaker" }
}
PUT /api/products/{product}
Update product (Admin).
Admin
PUT /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j
Request:
{
  "price": 64.99,
  "stock_quantity": 120
}
Response:
{
  "message": "Product updated successfully"
}
DELETE /api/products/{product}
Delete product (Admin).
Admin
DELETE /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j
Response:
{ "message": "Product deleted successfully" }
GET /api/products/low-stock
Get products with low stock (Admin).
Admin
GET /api/products/low-stock
Response:
[
  { "id": "c5a2b1d3-2b47-4c88-a6a1-5e3f71f9b7d9", "name": "Wireless Headphones", "stock_quantity": 3 }
]
GET /api/products/drafts
Get draft products (Admin).
Admin
GET /api/products/drafts
Response:
[
  { "id": "d3e4f5g6-h7i8-4j9k-8l0m-1n2o3p4q5r6s", "name": "Smart Watch", "status": "draft" }
]
POST /api/products/{product}/publish
Publish a draft product (Admin).
Admin
POST /api/products/d3e4f5g6-h7i8-4j9k-8l0m-1n2o3p4q5r6s/publish
Response:
{ "message": "Product published successfully", "status": "published" }
POST /api/products/{product}/upload-main-image
Upload main image for product (Admin).
Admin
POST /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j/upload-main-image
Request: multipart/form-data (file)
Response:
{ "message": "Main image uploaded successfully", "url": "https://example.com/images/products/new_main.jpg" }
POST /api/products/{product}/upload-gallery-images
Upload multiple gallery images (Admin).
Admin
POST /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j/upload-gallery-images
Request: multipart/form-data (files[])
Response:
{ "message": "Gallery images uploaded successfully", "urls": [
  "https://example.com/images/products/gallery1.jpg",
  "https://example.com/images/products/gallery2.jpg"
] }
DELETE /api/products/{product}/remove-gallery-image
Remove a gallery image (Admin).
Admin
DELETE /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j/remove-gallery-image
Request: { "url": "https://example.com/images/products/gallery1.jpg" }
Response:
{ "message": "Gallery image removed successfully" }
GET /api/products/{product}/image-urls
Get all image URLs for product.
Public
GET /api/products/a1b2c3d4-e5f6-4a7b-8c9d-1e2f3g4h5i6j/image-urls
Response:
{
  "main_image_url": "https://example.com/images/products/new_main.jpg",
  "gallery_image_urls": [
    "https://example.com/images/products/gallery1.jpg",
    "https://example.com/images/products/gallery2.jpg"
  ]
}

Categories

Product category management

GET /api/categories
Get all product categories.
Public Endpoint
GET /api/categories/tree
Get category hierarchy tree structure.
Public Endpoint
GET /api/categories/{category}
Get detailed information about a specific category.
Public Endpoint
GET /api/categories/{category}/products
Get products belonging to a specific category.
Public Endpoint
POST /api/categories
Create a new product category.
Admin Only
PUT /api/categories/{category}
Update an existing category.
Admin Only
DELETE /api/categories/{category}
Delete a category.
Admin Only
POST /api/categories/{category}/upload-image
Upload an image for a category.
Admin Only

Brands

Brand management and product organization

GET /api/brands
Get all brands with pagination.
Public Endpoint
GET /api/brands/{brand}
Get detailed information about a specific brand.
Public Endpoint
GET /api/brands/{brand}/products
Get products belonging to a specific brand.
Public Endpoint
POST /api/brands
Create a new brand.
Admin Only
PUT /api/brands/{brand}
Update an existing brand.
Admin Only
DELETE /api/brands/{brand}
Delete a brand.
Admin Only
POST /api/brands/{brand}/upload-logo
Upload a logo for a brand.
Admin Only

Variants

Product variant management

GET /api/products/{product}/variants
Get all variants for a specific product.
Public Endpoint
GET /api/variants/{variant}
Get detailed information about a specific variant.
Public Endpoint
POST /api/variants/products/{product}/variants
Create a new variant for a product.
Admin Only
PUT /api/variants/{variant}
Update an existing variant.
Admin Only
DELETE /api/variants/{variant}
Delete a variant.
Admin Only
PUT /api/variants/{variant}/stock
Update stock quantity for a variant.
Admin Only
PUT /api/variants/products/{product}/variants/bulk-stock
Bulk update stock for multiple variants of a product.
Admin Only

Cart

Shopping cart management

GET /api/cart
Get current user's shopping cart items.
Auth Required
GET /api/cart/summary
Get cart summary including totals and item count.
Auth Required
POST /api/cart/items
Add item to shopping cart.
Auth Required
PUT /api/cart/items/{cart}
Update quantity of a cart item.
Auth Required
DELETE /api/cart/items/{cart}
Remove item from shopping cart.
Auth Required
DELETE /api/cart/clear
Clear all items from shopping cart.
Auth Required

WishList

WishList management

GET /api/wishlist
Get current user's wishlist items.
Auth Required
POST /api/wishlist
Add product to wishlist.
Auth Required
DELETE /api/wishlist/{wishlist}
Remove item from wishlist.
Auth Required
POST /api/wishlist/{wishlist}/move-to-cart
Move wishlist item to shopping cart.
Auth Required

Orders

Order management and processing

GET /api/orders
Get current user's order history.
Auth Required
POST /api/orders
Create a new order from cart items.
Auth Required
GET /api/orders/{order}
Get detailed information about a specific order.
Auth Required
PUT /api/orders/{order}/status
Update order status.
Auth Required

Reviews

Product reviews and ratings

GET /api/products/{product}/reviews
Get reviews for a specific product.
Public Endpoint
POST /api/reviews
Create a new product review.
Auth Required
PUT /api/reviews/{review}
Update an existing review.
Auth Required
DELETE /api/reviews/{review}
Delete a review.
Auth Required
POST /api/reviews/{review}/helpful
Mark a review as helpful.
Auth Required
POST /api/reviews/{review}/report
Report a review as inappropriate.
Auth Required

Users

User profile management

GET /api/user/profile
Get current user's profile with detailed information.
Auth Required
PUT /api/user/profile
Update current user's profile information.
Auth Required
POST /api/user/change-password
Change user password.
Auth Required
POST /api/user/upload-avatar
Upload profile picture/avatar.
Auth Required
DELETE /api/user/remove-avatar
Remove profile picture/avatar.
Auth Required

Settings

Application settings management

GET /api/settings
Get all application settings.
Auth Required
PUT /api/settings
Update application settings.
Auth Required
GET /api/settings/{key}
Get a specific setting by key.
Auth Required

Admin

Administrative functions

GET /api/users
Get all users (admin access required).
Admin Only
GET /api/users/{user}
Get detailed information about a specific user.
Admin Only
PUT /api/users/{user}/roles
Update user roles and permissions.
Admin Only
DELETE /api/users/{user}
Delete a user account.
Admin Only
GET /api/users/statistics/overview
Get user statistics and analytics.
Admin Only
Copied to clipboard!