Skip to main content

Get Product Details

Retrieves complete information about a specific product.

Path Parameters

productId
string (uuid)
required
Product identifier

Response

id
string (uuid)
Product identifier
name
string
Product name
description
string
Product description
price
number
Product price
discountPrice
number
Discounted price (if discount active)
mainPhotoUrl
string
URL to main product image
category
object
Product category information
seller
object
Seller information
media
array
Additional product images and videos
attributes
array
Product attributes (size, color, material, etc.)
variants
array
Product variants (if applicable)
averageRating
number
Average customer rating
reviewCount
number
Total number of reviews

Response Codes

  • 200 OK - Product found
  • 400 Bad Request - Invalid product ID format
  • 404 Not Found - Product not found

Example

cURL
curl -X GET "https://your-server.com/api/products/product/3fa85f64-5717-4562-b3fc-2c963f66afa6"

Success Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "Premium Wireless Headphones",
  "description": "High-quality wireless headphones with noise cancellation",
  "price": 299.99,
  "discountPrice": 249.99,
  "mainPhotoUrl": "https://cdn.example.com/products/headphones-main.jpg",
  "category": {
    "id": "abc123",
    "name": "Electronics",
    "parentName": "Audio"
  },
  "seller": {
    "id": "seller-uuid",
    "shopName": "AudioPro Shop",
    "rating": 4.8
  },
  "media": [
    {
      "id": "media-1",
      "url": "https://cdn.example.com/products/headphones-2.jpg",
      "type": "Image"
    }
  ],
  "attributes": [
    {
      "name": "Color",
      "value": "Black"
    },
    {
      "name": "Battery Life",
      "value": "30 hours"
    }
  ],
  "averageRating": 4.5,
  "reviewCount": 128
}

Get Products by Category

Retrieves products in a specific category with pagination.

Path Parameters

childCategoryId
string (uuid)
required
Child category identifier
page
integer
required
Page number (starts at 1)

Query Parameters

pageSize
integer
default:"20"
Number of products per page (default: 20)

Response

items
array
Array of product objects
totalCount
integer
Total number of products in category
currentPage
integer
Current page number
totalPages
integer
Total number of pages

Response Codes

  • 200 OK - Products retrieved
  • 400 Bad Request - Invalid page number (must be > 0)
  • 404 Not Found - Category not found

Example

cURL
curl -X GET "https://your-server.com/api/products/category/abc-123/page/1?pageSize=20"

Search Products

Searches for products by query string.

Query Parameters

searchQuery
string
required
Search query text
pageSize
integer
default:"20"
Number of results to return

Response

products
array
Array of matching products

Response Codes

  • 200 OK - Search completed
  • 400 Bad Request - Invalid or empty search query

Example

cURL
curl -X GET "https://your-server.com/api/products/search?searchQuery=wireless+headphones&pageSize=20"

Get Products with Discount

Retrieves products that have active discounts.

Path Parameters

page
integer
required
Page number (starts at 1)

Query Parameters

pageSize
integer
default:"4"
Number of products per page

Example

cURL
curl -X GET "https://your-server.com/api/products/with-discount/page/1?pageSize=10"

Get Random Products

Retrieves random products for homepage or discovery features.

Query Parameters

pageSize
integer
default:"12"
Number of random products to return

Example

cURL
curl -X GET "https://your-server.com/api/products/random?pageSize=12"

Create Product (Seller)

Creates a new product listing.

Request Body (multipart/form-data)

name
string
required
Product name
description
string
required
Product description
price
number
required
Product price
quantity
integer
required
Available quantity
categoryId
string (uuid)
required
Category ID
sellerId
string (uuid)
required
Seller ID
mainPhoto
file
required
Main product image file
attributes
array
required
Product attributes (JSON)

Response Codes

  • 204 No Content - Product created successfully
  • 400 Bad Request - Invalid data or missing required fields
  • 404 Not Found - Category or seller not found

Example

cURL
curl -X POST "https://your-server.com/api/products" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -F "name=Premium Wireless Headphones" \
  -F "description=High-quality audio" \
  -F "price=299.99" \
  -F "quantity=50" \
  -F "categoryId=abc-123" \
  -F "sellerId=seller-uuid" \
  -F "mainPhoto=@/path/to/image.jpg" \
  -F 'attributes=[{"attributeId":"attr-1","value":"Black"}]'

Update Product Price (Seller)

Updates the price of a product.

Path Parameters

productId
string (uuid)
required
Product identifier

Request Body

newPrice
number
required
New product price (must be > 0)

Response Codes

  • 204 No Content - Price updated
  • 400 Bad Request - Invalid price
  • 404 Not Found - Product not found

Example

cURL
curl -X PATCH "https://your-server.com/api/products/product/3fa85f64/price" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"newPrice": 279.99}'

Delete Product (Seller)

Deletes a product listing.

Path Parameters

productId
string (uuid)
required
Product identifier

Response Codes

  • 204 No Content - Product deleted
  • 404 Not Found - Product not found

Example

cURL
curl -X DELETE "https://your-server.com/api/products/3fa85f64-5717-4562-b3fc-2c963f66afa6" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN"

Filter Products by Attributes

Filters products based on attribute values.

Request Body

categoryId
string (uuid)
required
Category to filter within
filters
array
required
Array of attribute filters

Example

cURL
curl -X POST "https://your-server.com/api/products/filter-by-attributes" \
  -H "Content-Type: application/json" \
  -d '{
    "categoryId": "abc-123",
    "filters": [
      {"attributeName": "Color", "values": ["Black", "White"]},
      {"attributeName": "Brand", "values": ["Sony"]}
    ]
  }'

Build docs developers (and LLMs) love