Danh mục hàng hóa
Mô tả
Các API hỗ trợ:
-
GET /products: Lấy danh sách sản phẩm.
-
GET /products/{id}: Lấy chi tiết 1 sản phẩm.
-
POST /products: Thêm mới 1 sản phẩm.
-
PUT /products/{id}: Cập nhật sản phẩm.
-
DELETE /products/{id}: Xóa sản phẩm.
API
GET /api/products
Lấy danh sách sản phẩm, hỗ trợ các tham số filter sau:
| Tên trường | Kiểu dữ liệu | Mô tả |
|---|---|---|
| merchant_product_id | string | Mã hàng hóa |
| name | string | Tên hàng hóa |
| category | string | Chủng loại |
| warehouse_id | string | Mã kho |
| zone_id | string | Mã khu vực |
| area_id | string | Mã vị trí |
| sort | integer | Tên trường sắp xếp |
| order | integer | Thứ tự sắp xếp |
| page | integer | Trang |
| size | integer | Số bản ghi trên trang |
GET /api/products?merchant_product_id=408798&name=Andie&category=Ready&page=1&size=10order=asc&sort=name
{
"code": 200,
"message": "Success",
"result": [
{
"id": "1764f8e4-a1bc-44f3-80d7-8ed936d6eee7",
"merchant_product_id": "000009",
"gs1_gtin": "00000320000094",
"name": "123",
"category": "123",
"price": 123.0,
"quantity": 7,
"col_1": "q",
"col_2": "2",
"col_3": "3",
"col_4": null,
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null,
"thumbnail": null,
"merchant_id": "00000000-0000-0000-0000-000000000004",
"deleted": 0,
"created_at": "2023-12-15T04:16:34.000Z",
"created_by": "admin",
"updated_at": "2024-03-30T17:30:00.000Z",
"updated_by": "SYSTEM_USER"
}
],
"page": 1,
"page_size": 10,
"total": 1
}
GET /api/products/{id}
Lấy chi tiết 1 sản phẩm.
GET /api/products/0288d26f-b9ca-46c7-85c5-9b167d502ea5
{
"code": 200,
"message": "Thành công",
"result": {
"id": "1764f8e4-a1bc-44f3-80d7-8ed936d6eee7",
"merchant_product_id": "000009",
"gs1_gtin": "00000320000094",
"name": "123",
"category": "123",
"price": 123.0,
"quantity": 7,
"col_1": "q",
"col_2": "2",
"col_3": "3",
"col_4": null,
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null,
"thumbnail": null,
"merchant_id": "00000000-0000-0000-0000-000000000004",
"deleted": 0,
"inventories": [
{
"warehouse_id": "4e14dbda-95dc-48ac-8e78-0b8669d76449",
"zone_id": null,
"area_id": null,
"serial": 10,
"rfid": "3018000F406BC302540BE40A"
}
],
"created_at": "2023-12-15T04:16:34.000Z",
"created_by": "admin",
"updated_at": "2024-03-30T17:30:00.000Z",
"updated_by": "SYSTEM_USER"
}
}
POST /api/products
Thêm mới sản phẩm.
Request Body
-
merchant_product_id: (string) Mã sản phẩm. -
name: (string) Tên sản phẩm. -
price: (double) Giá sản phẩm. -
category: (string) Chủng loại. -
col_1: (string) Thuộc tính 1. -
col_2: (string) Thuộc tính 2. -
col_3: (string) Thuộc tính 3. -
col_4: (string) Thuộc tính 4. -
col_5: (string) Thuộc tính 5. -
col_6: (string) Thuộc tính 6. -
col_7: (string) Thuộc tính 7. -
col_8: (string) Thuộc tính 8. -
col_9: (string) Thuộc tính 9. -
col_10: (string) Thuộc tính 10
{
"merchant_product_id": "408798",
"name": "Andie Relaxed Shirt_2775TAND-ALFL",
"price": 5000998.0,
"category": "Ready to wear",
"col_1": "",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null
}
POST /api/products
PUT /api/products/{id}
Cập nhật sản phẩm.
Request Body
-
name: (string) Tên sản phẩm. -
price: (double) Giá sản phẩm. -
category: (string) Chủng loại. -
col_1: (string) Thuộc tính 1. -
col_2: (string) Thuộc tính 2. -
col_3: (string) Thuộc tính 3. -
col_4: (string) Thuộc tính 4. -
col_5: (string) Thuộc tính 5. -
col_6: (string) Thuộc tính 6. -
col_7: (string) Thuộc tính 7. -
col_8: (string) Thuộc tính 8. -
col_9: (string) Thuộc tính 9. -
col_10: (string) Thuộc tính 10
{
"name": "Andie Relaxed Shirt_2775TAND-ALFL",
"price": "5000998"
"category": "Ready to wear",
"col_1": "",
"col_2": "",
"col_3": "",
"col_4": "",
"col_5": null,
"col_6": null,
"col_7": null,
"col_8": null,
"col_9": null,
"col_10": null
}
PUT /api/products/d529573a-f87c-4233-a917-13ad74349f35
DELETE /api/products/{id}
Xóa sản phẩm.
DELETE /api/products/d529573a-f87c-4233-a917-13ad74349f35