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

Cập nhật sản phẩm

Cập nhật toàn bộ thông tin một sản phẩm

Endpoint

PUT /v1/products/:id

Request Body

TrườngKiểuBắt buộcMô tả
company_idintID công ty
creator_idintID người thao tác
namestringTên sản phẩm
name_shortstringKhôngTên ngắn của sản phẩm
codestringKhôngMã sản phẩm. Phải là duy nhất.
external_idstringKhôngID tham chiếu hệ thống ngoài. Phải là duy nhất.
statusint1 (Nháp), 3 (Hoạt động), 5 (Lưu trữ/Đã xóa)
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
optionsarrayKhôngCấu trúc tùy chọn biến thể (Size, Color...)`
sell_on_zerointKhông1: Cho phép bán khi tồn kho bằng 0. Với sản phẩm dạng booking đính kèm thì luôn = 1.
visibilityintKhôngTrạng thái hiển thị sản phẩm
installmentarrayKhôngCấu hình trả góp
tax_ratiofloatKhôngThuế suất (%)
weight_sale_modeintKhôngChế độ bán theo trọng lượng (chỉ dùng khi weight_type là 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 vật lý cho Catch weight (khi weight_sale_mode là Counting)
pricing_typeintKhôngLoại định giá
allow_preorderintKhôngCho 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
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
need_customizeintKhông1: Cần tùy biến trước khi bá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 (dùng cho logistics/đóng gói)
widthintKhôngChiều rộng
heightintKhôngChiều cao
packing_priorityintKhôngĐộ ưu tiên khi sắp xếp đóng gói
page_idintKhôngID trang nội dung liên kết
default_warehouse_location_idintKhôngVị 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
badgestringKhôngNhãn hiển thị (Mới, Hot, ...)
certificationstringKhôngThông tin chứng nhận
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 (nếu trống sẽ được auto-gen từ name + code)
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 dùng cho Open Graph
seo_canonicalstringKhôngCanonical URL
seo_optionsarrayKhôngCác tùy chọn SEO khác
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
product_uomsarrayKhôngDanh sách đơn vị tính quy đổi (nếu có), được xử lý riêng qua processProductUom()

Ví dụ Request Body

Ví dụ payload đầy đủ (tham khảo từ dữ liệu thực tế) khi cập nhật một sản phẩm đang hoạt động:

{
  "company_id": 10311,
  "creator_id": 1,
  "name": "Áo Thun Nam BT TEST 01",
  "name_short": "",
  "summary": "",
  "description": "",
  "code": "AT.BT.TS001",
  "options": [
    {
      "option_id": 8,
      "use_image": 1,
      "option_values": [
        {
          "option_id": 8,
          "option_value_id": 4,
          "option_value_name": "Đen",
          "uuid": "4abdd739-a132-49bd-9ed8-341ae6d48bbc",
          "file_id_list": [],
          "file_list": [],
          "meta": []
        }
      ]
    },
    {
      "option_id": 9,
      "use_image": 1,
      "option_values": [
        {
          "option_id": 9,
          "option_value_id": 14,
          "option_value_name": "L",
          "uuid": "7d66253a-9c87-43f2-996b-712e015aa992",
          "file_id_list": [],
          "file_list": [],
          "meta": []
        },
        {
          "option_id": 9,
          "option_value_id": 84,
          "option_value_name": "S",
          "uuid": "70348955-c609-41b0-9b29-ca596d2af292",
          "file_id_list": [],
          "file_list": [],
          "meta": []
        },
        {
          "option_id": 9,
          "option_value_id": 85,
          "option_value_name": "M",
          "uuid": "4606380c-9acb-48c2-a810-d2ceb4892e8d",
          "file_id_list": [],
          "file_list": [],
          "meta": []
        }
      ]
    }
  ],
  "external_id": "",
  "category_primary": 212,
  "category_id_list": [],
  "brand_id": 117,
  "supplier_id": [36, 40, 41],
  "sell_on_zero": 0,
  "info_package": "",
  "info_warranty": "",
  "info_promotion": "",
  "info_promotion_note": "",
  "visibility": 1,
  "installment": [],
  "tax_ratio": 0,
  "weight_sale_mode": 0,
  "category_displayorder": [
    {
      "id": 212,
      "label": "Áo thun",
      "order": 9999
    }
  ],
  "weight_type": 1,
  "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": "",
  "badge": "",
  "certification": "",
  "status": 3,
  "seo_url": "ao-thun-nam-bt-test-01",
  "seo_title": "Áo Thun Nam BT TEST 01",
  "seo_meta_description": "",
  "seo_meta_keyword": "",
  "seo_graph_file_id": 0,
  "seo_canonical": "",
  "seo_options": {},
  "avatar_file_id_list": [4596],
  "photo_gallery_file_id_list": [4597],
  "photo360_file_id_list": [],
  "embed_video_scripts": "[]",
  "attribute_detail": [],
  "tags": [
    "ao-thun",
    "bt-test-01"
  ],
  "note": "",
  "product_uoms": [
    {
      "company_id": 10311,
      "creator_id": 15526,
      "uom_id": 1000,
      "allow_sale": 1,
      "allow_purchase": 1,
      "allow_stock": 1,
      "factor": 1,
      "weight": 320,
      "is_default": 1,
      "display_order": 0,
      "icon_svg": "",
      "file_id_list": [],
      "file_list": []
    }
  ],
  "booking_attachable": 0,
  "need_customize": 0,
  "mockup_supported": 0,
  "config3d_supported": 0,
  "material_type": 0,
  "length": 100,
  "width": 100,
  "height": 100,
  "packing_priority": 100,
  "page_id": 0,
  "default_warehouse_location_id": 10003,
  "lead_time": 0,
  "expiry_tracked": 0
}

Response Schema

HTTP 200 - OK

Trả về Product Object sau khi cập nhật.

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_permission_not_foundKhông có quyền chỉnh sửa sản phẩm (cần product.manage hoặc product.managecontent)
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_option_id_invalid(ID #X)ID tùy chọn (option) không hợp lệ
error_option_value_id_invalid(ID #X, inside Option ID #Y)ID giá trị tùy chọn không hợp lệ
error_option_value_created(Name #X, inside Option ID #Y)Không thể tạo giá trị tùy chọn mới
error_option_value_file_id_list_invalid(Name #X, inside Option ID #Y)File ID trong giá trị tùy chọn 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