Skip to content

Get Variant By ID (Admin)

Get a specific product variant by its ID for admin.

Endpoint

GET /v1/products/variant/get-by/admin/?id={variant_id}&product_id={product_id}

Authentication

Required (Admin role)

Query Parameters

Parameter Type Required Description
id integer Yes Variant ID
product_id integer Yes Product ID

Response

Success (200 OK)

{
  "id": 1,
  "product_id": 5,
  "product": {
    "id": 5,
    "store_id": 3,
    "store": {...},
    "category_id": 2,
    "category": {...},
    "brand_id": 1,
    "brand": {...},
    "currency_id": 1,
    "currency": {...},
    "created": "2025-01-15T10:30:00Z"
  },
  "name_az": "Məhsul Adı",
  "name_en": "Product Name",
  "name_es": "Nombre del Producto",
  "name_de": "Produktname",
  "description_az": "Məhsul Təsviri",
  "description_en": "Product Description",
  "sku": "SKU-001",
  "stock_quantity": 100,
  "price": 29.99,
  "attributes": [...],
  "images": [...],
  "created": "2025-01-15T10:30:00Z"
}

Error Responses

Product Not Found (404)

{
  "error": "Product not found"
}

Variant Not Found (404)

{
  "error": "Product Variant not found"
}

Example Request

curl -X GET "https://api.luxmart.site/v1/products/variant/get-by/admin/?id=1&product_id=5" \
  -H "Authorization: Token your_access_token"

Notes

  • Variant must belong to the specified product
  • Only returns non-deleted variants
  • Includes full product, store, category, brand, and currency information