Tạo mới sản phẩm
Developing
Test Env
Test Env
POST
api/public/product-masters
Request
Header Params
X-API-Key
string
optional
Body Params multipart/form-data
product_name
string
required
Example:
Sản phẩm 1
short_name
string
optional
Example:
SP1
product_code
string
optional
product_barcode
string | null
optional
Example:
119821732
description
string
optional
Example:
Tạo mới SP1
available
integer
required
Example:
1
product_tax
number
optional
>= 0
Example:
0
category_name
string
required
Example:
Nước
allow_overselling
boolean
required
Example:
true
product_price
number
required
>= 0
Example:
20000
product_type
integer
required
Lưu ý: Đối với mặt hàng là combo thì gửi lên với giá trị là 5
Default:
1
Example:
1
automatically_create_inventory_items
boolean | null
optional
Lưu ý: Không cần gửi lên nếu không dùng kho
Example:
true
inventory_management_flg
boolean
optional
Lưu ý: Không cần gửi lên nếu không dùng kho
Lưu ý 2: Nếu đã gửi lên cờ automatically_create_inventory_items = 1 thì không cần gửi cờ này nữa vì hệ thống sẽ tự động tích cờ inventory_management_flg này
Example:
true
alert_flg
boolean
optional
Lưu ý: Không cần gửi lên nếu không dùng kho
Example:
false
alert_minval
number | null
optional
Lưu ý: Không cần gửi lên nếu không dùng kho
Example:
0
alert_maxval
number | null
optional
Lưu ý: Không cần gửi lên nếu không dùng kho
Example:
0
reseller_flg
boolean
required
Example:
true
allow_online_sale
boolean
required
Lưu ý: Hiển thị mặt hàng trên web order thì hãy gửi lên 1
Example:
false
last_input_price
number | null
optional
Example:
0
cost_price
number | null
optional
Example:
0
unit_list
array [object {7}]
required
Lưu ý: Trong mảng thì luôn phải tồn tại 1 phần tử mảng với key is_primary = 1 để hệ thống có thể xác định xem đơn vị tính nào bán mặc định
Example:
["{\n \"unit_name\": \"cái\",\n \"unit_exchange\": 1,\n \"is_primary\": 1,\n \"sell_flg\": 1,\n \"price\": 20000,\n \"product_barcode\": null\n}","{\n \"unit_name\": \"lốc\",\n \"unit_exchange\": 1,\n \"is_primary\": 0,\n \"sell_flg\": 0,\n \"price\": 25000,\n \"product_barcode\": null\n}"]
unit_name
string
optional
unit_exchange
number
optional
price
number
optional
is_primary
number
optional
sell_flg
number
optional
old_price
number
optional
product_barcode
string
optional
thumbnails
array [object {8}] | null
optional
thumbnail_image
object
optional
thumbnail_image_x
number
optional
thumbnail_image_y
number
optional
thumbnail_image_w
number
optional
thumbnail_image_h
number
optional
thumbnail_image_resize_to_width
number
optional
is_image_change
number
optional
thumbnail_image_resize_to_height
number
optional
feature
string
optional
Lưu ý: Nếu tạo biến thể thì hãy gửi trường này còn chỉ tạo sản phẩm thôi thì không cần gửi
Example:
[
{
"name": "Kích thước",
"value": [
"l",
"s",
"m"
]
},
{
"name": "Màu sắc",
"value": [
"xanh",
"đỏ",
"cam"
]
}
]
variants
array [object {6}]
optional
Lưu ý: Nếu tạo biến thể thì hãy gửi trường này còn chỉ tạo sản phẩm thôi thì không cần gửi
Example:
["{\n \"product_id\": \"0\",\n \"product_name\": \"s / đỏ\",\n \"product_code\": null,\n \"units\": [\n {\n \"product_barcode\": \"null\",\n \"price\": \"0\",\n \"old_price\": \"0\",\n \"cost_price\": \"0\",\n \"last_input_price\": \"0\",\n \"unit_name\": \"cái\",\n \"unit_exchange\": \"1\",\n \"is_primary\": \"true\"\n }\n ],\n \"last_input_price\": \"0\",\n \"cost_price\": \"0\"\n}","{\n \"product_id\": \"0\",\n \"product_name\": \"m / đỏ\",\n \"product_code\": null,\n \"units\": [\n {\n \"product_barcode\": \"null\",\n \"price\": \"0\",\n \"old_price\": \"0\",\n \"cost_price\": \"0\",\n \"last_input_price\": \"0\",\n \"unit_name\": \"cái\",\n \"unit_exchange\": \"1\",\n \"is_primary\": \"true\"\n }\n ],\n \"last_input_price\": \"0\",\n \"cost_price\": \"0\"\n}","{\n \"product_id\": \"0\",\n \"product_name\": \"l / đỏ\",\n \"product_code\": null,\n \"units\": [\n {\n \"product_barcode\": \"null\",\n \"price\": \"0\",\n \"old_price\": \"0\",\n \"cost_price\": \"0\",\n \"last_input_price\": \"0\",\n \"unit_name\": \"cái\",\n \"unit_exchange\": \"1\",\n \"is_primary\": \"true\"\n }\n ],\n \"last_input_price\": \"0\",\n \"cost_price\": \"0\"\n}"]
product_id
number
optional
product_name
string
optional
product_code
string
optional
last_input_price
number
optional
cost_price
number
optional
units
array [object {5}]
optional
combo
array [object {5}]
optional
Lưu ý: Khi muốn tạo combo thì mới gửi lên trường này còn tạo sản phẩm thì không gửi lên
Lưu ý 2: Key này sẽ truyền lên dạng string array ví dụ "['a','b','c']"
Example:
["[\n {\n \"title\": \"combo nước\",\n \"group_local_id\": \"17422693572593021570685368544\",\n \"select_type\": 1,\n \"max_choose\": 1,\n \"products\": [\n {\n \"local_id\": \"17422693869154621570685368413\",\n \"group_local_id\": \"17422693572593021570685368544\",\n \"product_master_id\": 1119256,\n \"product_id\": 1120566,\n \"name\": \"number 1\",\n \"product_type\": 1,\n \"quantity\": 1,\n \"price\": 0,\n \"unit_id\": 115691,\n \"unit_name\": \"chai\",\n \"unit_exchange\": 1,\n \"quantitative\": 1,\n \"product_master_unit\": [\n {\n \"id\": 1329639,\n \"product_id\": 1120566,\n \"product_master_id\": 1119256,\n \"unit_id\": 115691,\n \"unit_name\": \"chai\",\n \"unit_exchange\": 1,\n \"is_primary\": 1,\n \"cost_price\": 0,\n \"sell_flg\": 1,\n \"product_barcode\": \"\",\n \"available\": 1,\n \"price\": 25000\n }\n ],\n \"combo_price\": 25000,\n \"vat_price\": 0,\n \"hide_component\": false\n },\n {\n \"local_id\": \"17422693906354711570685368811\",\n \"group_local_id\": \"17422693572593021570685368544\",\n \"product_master_id\": 1119252,\n \"product_id\": 1120562,\n \"name\": \"Nutri\",\n \"product_type\": 1,\n \"quantity\": 1,\n \"repeat_type\": 0,\n \"price\": 0,\n \"editable_flg\": 0,\n \"unit_id\": 115691,\n \"unit_name\": \"chai\",\n \"unit_exchange\": 1,\n \"quantitative\": 1,\n \"product_master_unit\": [\n {\n \"id\": 1329636,\n \"product_id\": 1120562,\n \"product_master_id\": 1119252,\n \"shop_id\": 1570685368,\n \"unit_id\": 115691,\n \"unit_name\": \"chai\",\n \"unit_exchange\": 1,\n \"is_primary\": 1,\n \"cost_price\": 0,\n \"product_material\": \"[]\",\n \"sell_flg\": 1,\n \"product_barcode\": \"\",\n \"available\": 1,\n \"old_price\": 0,\n \"default_inventory_management_flg\": false,\n \"price\": 25000\n }\n ],\n \"combo_price\": 25000,\n \"vat_price\": 0,\n \"hide_component\": false\n }\n ]\n }\n]"]
title
string
optional
group_local_id
string
optional
select_type
number
optional
max_choose
number
optional
products
array [object {15}]
optional
Request samples
Responses
Modified at 2025-03-18 06:01:46