Products
Məhsulların siyahısını və tək məhsulun detalını qaytarır.
List
Əlaqəli endpoint: Product-List Swagger
GET /api/v1/catalog/products/
Filtrlər
| key | məlumat |
|---|---|
category |
Kateqoriyanın id-si. Seçilmiş kateqoriya və onun bütün alt kateqoriyalarındakı məhsullar qayıdır |
product_type |
Məhsul tipinin id-si |
attr_{name} |
Atribut üzrə filtr. {name} atributun adıdır (məs. attr_rəng). Vergüllə bir neçə dəyər verilə bilər (attr_rəng=qara,ağ → qara və ya ağ) |
page |
Səhifə nömrəsi (default 1) |
page_size |
Səhifədəki element sayı (default 10, maksimum 100) |
Atributların mümkün adları və dəyərləri Attributes endpointindən alınır. attr_* filtrləri aktiv dilə (Accept-Language) görə uyğunlaşdırılır.
Nümunə: GET /api/v1/catalog/products/?category=1&attr_rəng=qara,ağ&page_size=20
Response
HTTP STATUS code 200
{
"next": null,
"previous": null,
"count": 1,
"current": 1,
"page_size": 10,
"results": [
{
"id": 7,
"title": "Galaxy S24",
"subtitle": "256 GB",
"slug": "galaxy-s24",
"img": "/media/product_images/s24.jpg",
"images": [
{ "id": 11, "image": "/media/product_images/s24-1.jpg" }
],
"category": { "id": 3, "name": "Smartfonlar", "parent": 1 },
"product_type": { "id": 2, "name": "Telefon" }
}
]
}
results arrayindəki product obyekti:
| key | məlumat | çoxdil |
|---|---|---|
id |
Məhsulun identifikatoru | - |
title |
Məhsulun başlığı | Var |
subtitle |
Məhsulun alt başlığı | Var |
slug |
Detal endpointində istifadə olunan unikal slug | Var |
img |
Əsas (cover) şəkil. Şəkil yoxdursa null |
Var |
images |
Əlavə şəkillər arrayi (id, image) |
- |
category |
Məhsulun kateqoriyası (id, name, parent) |
- |
product_type |
Məhsul tipi (id, name) |
- |
Detail
Əlaqəli endpoint: Product-Detail Swagger
GET /api/v1/catalog/products/{slug}/
{slug} aktiv dildən asılı olmayaraq məhsulun istənilən dildəki slug-ı ilə uyğunlaşdırılır. Uyğun məhsul tapılmasa 404 qayıdır.
Response
HTTP STATUS code 200
{
"id": 7,
"title": "Galaxy S24",
"subtitle": "256 GB",
"slug": "galaxy-s24",
"description": "Tam təsvir mətni...",
"img": "/media/product_images/s24.jpg",
"images": [
{ "id": 11, "image": "/media/product_images/s24-1.jpg" }
],
"category": { "id": 3, "name": "Smartfonlar", "parent": 1 },
"product_type": { "id": 2, "name": "Telefon" },
"attributes": {
"Rəng": { "value": "qara", "file_value": null, "type": "text" },
"Sənəd": { "value": {}, "file_value": "/media/product_attr_values/doc.pdf", "type": "file" }
}
}
List cavabındakı sahələrə əlavə olaraq:
| key | məlumat | çoxdil |
|---|---|---|
description |
Məhsulun tam təsviri | Var |
attributes |
Məhsulun atributları. Açar atributun adıdır, dəyəri isə atribut obyektidir | Var |
attributes obyektindəki hər atribut:
| key | məlumat | çoxdil |
|---|---|---|
value |
Atributun dəyəri. text, number, boolean və s. tiplərdə sadə dəyər, fayl tiplərində boş ola bilər |
Var |
file_value |
file/image tipli atributlarda fayl URL-i, əks halda null |
Var |
type |
Atributun tipi (aşağıdakı siyahıya bax) | - |
type siyahısı:
textnumberbooleandatetimedatetimefileimage