OVIRO LogoOVIRO
Quản lý nhóm sản phẩmGợi ý sản phẩm

Tạo gợi ý

Tạo mới một bản ghi gợi ý sản phẩm

Endpoint (Single)

POST /v1/productsuggestions

Quyền: product.managecontent

Endpoint (Batch)

POST /v1/productsuggestions/addlist

Quyền: product.managecontent

Request Body (Single)

TrườngKiểuBắt buộcMô tả
company_idintID công ty
creator_idintID người tạo
product_idintID sản phẩm gốc
object_typeintLoại đối tượng gợi ý (1: Product)
object_idintID đối tượng gợi ý (ID sản phẩm được gợi ý)
product_suggestion_group_idintKhôngID nhóm gợi ý (Mặc định 0)
display_orderfloatKhôngThứ tự hiển thị (tự tính max + 1)
statusintKhôngTrạng thái (1: Active, 3: Disabled. Mặc định: 1)

Ví dụ JSON (Single)

{
    "company_id": 1,
    "creator_id": 10,
    "product_id": 10,
    "object_type": 1,
    "object_id": 12,
    "product_suggestion_group_id": 0,
    "display_order": 0,
    "status": 1
}

Request Body (Batch)

Gửi company_id, creator_id ở cấp ngoài cùng, và mảng items chứa danh sách các gợi ý cần tạo.

{
    "company_id": 1,
    "creator_id": 10,
    "items": [
        {
            "product_id": 10,
            "object_type": 1,
            "object_id": 12,
            "product_suggestion_group_id": 0,
            "display_order": 0,
            "status": 1
        },
        {
            "product_id": 10,
            "object_type": 1,
            "object_id": 15,
            "product_suggestion_group_id": 0,
            "display_order": 0,
            "status": 1
        }
    ]
}

Response Schema (Single)

HTTP 201 - Created

Trả về ProductSuggestion Object vừa tạo.

Response Schema (Batch)

HTTP 200 - OK

Trả về danh sách các item đã tạo và lỗi (nếu có).

TrườngKiểuMô tả
totalintSố item tạo thành công
currentpageintTrang hiện tại (luôn = 1)
limitintSố item
itemsarrayMảng ProductSuggestion Object đã tạo
errorarrayMảng mã lỗi (nếu có)

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_not_foundSản phẩm gốc không tìm thấy
error_object_type_invalidLoại đối tượng gợi ý không hợp lệ
error_object_id_requiredID đối tượng gợi ý không được để trống
error_object_id_same_as_productĐối tượng gợi ý không được trùng với sản phẩm gốc
error_target_product_not_foundSản phẩm được gợi ý không tìm thấy
error_target_product_already_existedGợi ý này đã tồn tại
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