Quản lý nhóm sản phẩmBộ sưu tập sản phẩm
Tạo bộ sưu tập
Tạo mới một bộ sưu tập sản phẩm
Endpoint
POST /v1/productcollections
Request Body
| Trường | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|
company_id | int | Có | ID công ty |
creator_id | int | Có | ID người tạo |
name | string | Có | Tên bộ sưu tập (duy nhất trong công ty) |
type | int | Có | Loại (1: Auto, 3: Manual) |
description | string | Không | Mô tả |
external_id | string | Không | ID tham chiếu ngoài |
status | int | Có | 1 (Active), 3 (Disabled) |
avatar_file_id_list | array | Không | Danh sách ID ảnh đại diện |
product_id_list | array | Không | Danh sách ID sản phẩm (nếu type = 3) |
auto_rule | object | Không | Cấu hình rule tự động (nếu type = 1). Xem Object Schema |
seo_url | string | Không | URL SEO (duy nhất) |
seo_title | string | Không | Title SEO |
seo_meta_description | string | Không | Meta Description |
seo_meta_keyword | string | Không | Meta Keyword |
seo_graph_file_id | int | Không | Ảnh SEO Graph |
seo_canonical | string | Không | Canonical URL |
seo_options | object | Không | Tùy chọn SEO |
Ví dụ JSON (Manual)
{
"company_id": 1,
"creator_id": 10,
"name": "Bộ sưu tập thủ công",
"type": 3,
"description": "Các sản phẩm hot tháng 12",
"external_id": "",
"status": 1,
"avatar_file_id_list": [],
"product_id_list": [101, 102, 105],
"auto_rule": {},
"seo_url": "bo-suu-tap-thu-cong",
"seo_title": "Bộ sưu tập thủ công",
"seo_meta_description": "",
"seo_meta_keyword": "",
"seo_graph_file_id": 0,
"seo_canonical": "",
"seo_options": {}
}Ví dụ JSON (Auto)
{
"company_id": 1,
"creator_id": 10,
"name": "Điện thoại Samsung dưới 10tr",
"type": 1,
"description": "",
"external_id": "",
"status": 1,
"avatar_file_id_list": [],
"product_id_list": [],
"auto_rule": {
"match_all": 1,
"conditions": [
{
"field": "productname",
"operand": "contain",
"value": "Samsung"
},
{
"field": "price",
"operand": "lessthan",
"value": "10000000"
}
]
},
"seo_url": "",
"seo_title": "",
"seo_meta_description": "",
"seo_meta_keyword": "",
"seo_graph_file_id": 0,
"seo_canonical": "",
"seo_options": {}
}Response Schema
HTTP 201 - Created
Trả về ProductCollection Object vừa tạo.
Error Codes
Lỗi dữ liệu đầu vào. Trả về mảng các mã lỗi:
| Mã lỗi | Mô tả |
|---|---|
error_name_require | Tên bộ sưu tập không được để trống |
error_name_existed | Tên bộ sưu tập đã tồn tại |
error_seo_url_existed | SEO URL đã tồn tại |
error_company_id_required | ID công ty không được để trống |
error_company_id_notfound | ID công ty không tìm thấy |
error_user1_id_required | ID người tạo không được để trống |
error_user_id_notfound | ID người tạo không tìm thấy |