OVIRO LogoOVIRO
Quản lý nhóm sản phẩmBiến thể sản phẩm

Tạo biến thể

Tạo mới một biến thể cho sản phẩm

Endpoint

POST /v1/productvariants

Quyền: product.manage hoặc product.managecontent

Request Body

TrườngKiểuBắt buộcMô tả
company_idintID công ty
creator_idintID người tạo
product_idintID sản phẩm cha
skustringKhôngMã SKU (duy nhất trong công ty, sẽ bị trim khoảng trắng)
priceintGiá bán
statusintTrạng thái (3: Active, 5: Archived)
uuidstringKhôngUUID biến thể
option_valuesarrayKhôngDanh sách giá trị tùy chọn định danh biến thể
barcodestringKhôngMã barcode
display_namestringKhôngTên hiển thị riêng
notestringKhôngGhi chú nội bộ
compare_priceintKhôngGiá so sánh (giá gốc)
min_stockintKhôngTồn kho tối thiểu
is_serial_trackedintKhông1: Theo dõi serial/IMEI
is_bom_kitintKhông1: Là BOM Kit (chỉ set khi tạo)
lengthintKhôngChiều dài (mm)
widthintKhôngChiều rộng (mm)
heightintKhôngChiều cao (mm)
weightintKhôngTrọng lượng (gram)
external_idstringKhôngID tham chiếu ngoài
price_by_uomarrayKhôngGiá theo đơn vị tính
photo_gallery_file_id_listarrayKhôngDanh sách ID ảnh gallery
combo_dataarrayKhôngDữ liệu combo (nếu sản phẩm combo)
bomarrayKhôngBill of Materials
display_orderintKhôngThứ tự hiển thị

Ví dụ JSON

{
    "company_id": 1,
    "creator_id": 10,
    "product_id": 123,
    "sku": "POLO-RED-M",
    "price": 250000,
    "status": 3,
    "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "option_values": [
        {
            "option_id": 10,
            "option_value_name": "Do"
        },
        {
            "option_id": 11,
            "option_value_name": "M"
        }
    ],
    "barcode": "8938502234534",
    "display_name": "",
    "note": "",
    "compare_price": 0,
    "min_stock": 0,
    "is_serial_tracked": 0,
    "is_bom_kit": 0,
    "length": 0,
    "width": 0,
    "height": 0,
    "weight": 0,
    "external_id": "",
    "price_by_uom": [],
    "photo_gallery_file_id_list": [],
    "combo_data": [],
    "bom": [],
    "display_order": 1001
}

Response Schema

HTTP 201 - Created

Trả về ProductVariant 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ỗiMô tả
error_product_requireID sản phẩm không được để trống
error_product_not_foundSản phẩm không tìm thấy
error_sku_existMã SKU đã tồn tại
error_status_not_existTrạng thái không tồn tại
error_product_permission_not_foundQuyền hạn không đủ (cần product.manage hoặc product.managecontent)
error_company_id_requiredID công ty không được để trống
error_company_id_notfoundID công ty không tìm thấy
error_user1_id_requiredID người tạo không được để trống
error_user_id_notfoundID người tạo không tìm thấy

On this page