OVIRO LogoOVIRO
Quản lý nhóm sản phẩmSản phẩm

Tạo sản phẩm

Tạo mới một sản phẩm

Endpoint

POST /v1/products

Quyền: product.manage

Request Body

TrườngKiểuBắt buộcMô tả
company_idintID công ty
creator_idintID người tạo
namestringTên sản phẩm (duy nhất trong công ty)
typeintLoại sản phẩm: 1 (Hàng hóa), 3 (IMEI), 5 (Combo), 7 (Dịch vụ)
codestringKhôngMã sản phẩm (duy nhất)
statusint1 (Nháp), 3 (Hoạt động), 5 (Lưu trữ)
is_bom_kitintKhông1: Là Combo/Kit (chỉ set khi tạo, không đổi được)
weight_typeintKhôngLoại trọng lượng (chỉ set khi tạo): 1 (Đơn vị), 3 (Cân nặng), 5 (Catch weight)
booking_attachableintKhông1: Sản phẩm đính kèm booking (chỉ set khi tạo, luôn sell_on_zero = 1)
optionsarrayKhôngCấu trúc tùy chọn biến thể (Size, Color...)
external_idstringKhôngID tham chiếu ngoài (duy nhất)
category_primaryintKhôngID danh mục chính
category_id_listarrayKhôngDanh sách ID danh mục phụ
brand_idintKhôngID thương hiệu
supplier_idarrayKhôngDanh sách ID nhà cung cấp
sell_on_zerointKhông1: Cho phép bán khi tồn kho bằng 0
visibilityintKhôngTrạng thái hiển thị
installmentarrayKhôngCấu hình trả góp
tax_ratiofloatKhôngThuế suất (%)
name_shortstringKhôngTên ngắn
tagsarrayKhôngDanh sách tag
notestringKhôngGhi chú nội bộ
attribute_detailarrayKhôngThông tin thuộc tính chi tiết
category_displayorderarrayKhôngThứ tự hiển thị theo danh mục
weight_sale_modeintKhôngChế độ bán theo trọng lượng
weight_presetsarrayKhôngCác mức cân nặng định sẵn
physical_catch_weight_uom_idintKhôngĐơn vị tính cho catch weight
pricing_typeintKhôngLoại định giá
allow_preorderintKhông1: Cho phép đặt hàng trước
default_variant_idintKhôngID biến thể mặc định
country_of_originstringKhôngXuất xứ
hs_codestringKhôngHS Code
need_customizeintKhông1: Cần tùy biến
mockup_supportedintKhông1: Hỗ trợ mockup
config3d_supportedintKhông1: Hỗ trợ cấu hình 3D
material_typeintKhôngLoại vật liệu
lengthintKhôngChiều dài (mm)
widthintKhôngChiều rộng (mm)
heightintKhôngChiều cao (mm)
packing_priorityintKhôngĐộ ưu tiên đóng gói
page_idintKhôngID trang nội dung
default_warehouse_location_idintKhôngID vị trí kho mặc định
lead_timeintKhôngThời gian chuẩn bị hàng (ngày)
expiry_trackedintKhông1: Theo dõi hạn sử dụng
summarystringKhôngTóm tắt sản phẩm
descriptionstringKhôngMô tả chi tiết
info_packagestringKhôngThông tin đóng gói
info_warrantystringKhôngThông tin bảo hành
info_promotionstringKhôngThông tin khuyến mãi
info_promotion_notestringKhôngGhi chú khuyến mãi
seo_urlstringKhôngURL SEO (tự sinh từ name + code nếu trống)
seo_titlestringKhôngTiêu đề SEO
seo_meta_descriptionstringKhôngMô tả Meta SEO
seo_meta_keywordstringKhôngTừ khóa SEO
seo_graph_file_idintKhôngID ảnh SEO Graph
seo_canonicalstringKhôngCanonical URL
seo_optionsobjectKhôngCác tùy chọn SEO
badgestringKhôngNhãn hiển thị (Mới, Hot...)
certificationstringKhôngThông tin chứng nhận
avatar_file_id_listarrayKhôngDanh sách ID ảnh đại diện
photo_gallery_file_id_listarrayKhôngDanh sách ID ảnh thư viện
photo360_file_id_listarrayKhôngDanh sách ID ảnh 360
embed_video_scriptsstringKhôngScript nhúng video

Lưu ý: Các trường type, weight_type, is_bom_kit, booking_attachable chỉ được gán khi tạo mới (không thể thay đổi khi edit). Trường procurement_type hiện được hardcode = 1 (Buy to stock).

Ví dụ JSON

{
    "company_id": 1,
    "creator_id": 10,
    "name": "Áo thun Polo mẫu mới",
    "type": 1,
    "code": "POLO2024",
    "status": 1,
    "is_bom_kit": 0,
    "weight_type": 1,
    "booking_attachable": 0,
    "options": [
        {
            "option_id": 10,
            "option_values": [
                { "option_value_name": "Đỏ" },
                { "option_value_name": "Xanh" }
            ]
        },
        {
            "option_id": 11,
            "option_values": [
                { "option_value_name": "S" },
                { "option_value_name": "M" }
            ]
        }
    ],
    "external_id": "",
    "category_primary": 105,
    "category_id_list": [],
    "brand_id": 12,
    "supplier_id": [36],
    "sell_on_zero": 1,
    "visibility": 1,
    "installment": [],
    "tax_ratio": 10.0,
    "name_short": "",
    "tags": ["ao-thun", "polo"],
    "note": "",
    "attribute_detail": [],
    "category_displayorder": [],
    "weight_sale_mode": 0,
    "weight_presets": [],
    "physical_catch_weight_uom_id": 0,
    "pricing_type": 1,
    "allow_preorder": 0,
    "default_variant_id": 0,
    "country_of_origin": "",
    "hs_code": "",
    "need_customize": 0,
    "mockup_supported": 0,
    "config3d_supported": 0,
    "material_type": 0,
    "length": 0,
    "width": 0,
    "height": 0,
    "packing_priority": 0,
    "page_id": 0,
    "default_warehouse_location_id": 0,
    "lead_time": 0,
    "expiry_tracked": 0,
    "summary": "",
    "description": "",
    "info_package": "",
    "info_warranty": "",
    "info_promotion": "",
    "info_promotion_note": "",
    "seo_url": "",
    "seo_title": "",
    "seo_meta_description": "",
    "seo_meta_keyword": "",
    "seo_graph_file_id": 0,
    "seo_canonical": "",
    "seo_options": {},
    "badge": "",
    "certification": "",
    "avatar_file_id_list": [],
    "photo_gallery_file_id_list": [],
    "photo360_file_id_list": [],
    "embed_video_scripts": ""
}

Response Schema

HTTP 201 - Created

Trả về Product 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_name_requireTên sản phẩm không được để trống
error_name_duplicatedTên sản phẩm đã tồn tại
error_code_existedMã sản phẩm (code) đã tồn tại
error_external_id_existedExternal ID đã tồn tại
error_status_not_existTrạng thái không hợp lệ
error_brand_not_validID thương hiệu không hợp lệ
error_supplier_not_validID nhà cung cấp không hợp lệ
error_category_not_validID danh mục không hợp lệ
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