PosApp Open APIs
  1. Sản phẩm
PosApp Open APIs
  • Tổng quan
  • Thẻ PosApp
    • Mã lỗi (error code)
    • API Idempotency
    • Nạp tiền vào thẻ
      POST
    • Kiểm tra trạng thái giao dịch
      POST
  • Thông tin khác
    • Digital Signature
  • Webhook
    • Tổng quan
    • Order Schema
    • Warehouse Import Schema
  • Sản phẩm
    • Tạo mới sản phẩm
      POST
    • Sửa một sản phẩm
      PATCH
    • Tồn kho sản phẩm
      POST
    • Cập nhật tên nhóm sản phẩm
      PATCH
  • Khuyến mãi
    • Đồng giá
      • Tạo khuyến mãi
      • Sửa khuyến mãi
    • Xóa khuyến mãi
      POST
  • Báo cáo
  1. Sản phẩm

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

Developing
Test Env
https://retail-api.posapp.vn/
Test Env
https://retail-api.posapp.vn/
POST
api/public/product-masters
API này cho phép thêm một sản phẩm mới vào hệ thống bằng cách gửi dữ liệu sản phẩm thông qua phương thức POST

Request

Header Params

Body Params multipart/form-data

Request Code Samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://retail-api.posapp.vn/api/public/product-masters' \
--header 'X-API-Key;' \
--form 'product_name="Sản phẩm 1"' \
--form 'short_name="SP1"' \
--form 'product_code=""' \
--form 'product_barcode="119821732"' \
--form 'description="Tạo mới SP1"' \
--form 'available="1"' \
--form 'product_tax="0"' \
--form 'category_name="Nước"' \
--form 'allow_overselling="true"' \
--form 'product_price="20000"' \
--form 'product_type="1"' \
--form 'automatically_create_inventory_items="true"' \
--form 'inventory_management_flg="true"' \
--form 'alert_flg="false"' \
--form 'alert_minval="0"' \
--form 'alert_maxval="0"' \
--form 'reseller_flg="true"' \
--form 'allow_online_sale="false"' \
--form 'last_input_price="0"' \
--form 'cost_price="0"' \
--form 'unit_list="{
    \"unit_name\": \"cái\",
    \"unit_exchange\": 1,
    \"is_primary\": 1,
    \"sell_flg\": 1,
    \"price\": 20000,
    \"product_barcode\": null
}"' \
--form 'unit_list="{
    \"unit_name\": \"lốc\",
    \"unit_exchange\": 1,
    \"is_primary\": 0,
    \"sell_flg\": 0,
    \"price\": 25000,
    \"product_barcode\": null
}"' \
--form 'thumbnails=""' \
--form 'feature="[
    {
        \"name\": \"Kích thước\",
        \"value\": [
            \"l\",
            \"s\",
            \"m\"
        ]
    },
    {
        \"name\": \"Màu sắc\",
        \"value\": [
            \"xanh\",
            \"đỏ\",
            \"cam\"
        ]
    }
]"' \
--form 'variants="{
    \"product_id\": \"0\",
    \"product_name\": \"s / đỏ\",
    \"product_code\": null,
    \"units\": [
        {
            \"product_barcode\": \"null\",
            \"price\": \"0\",
            \"old_price\": \"0\",
            \"cost_price\": \"0\",
            \"last_input_price\": \"0\",
            \"unit_name\": \"cái\",
            \"unit_exchange\": \"1\",
            \"is_primary\": \"true\"
        }
    ],
    \"last_input_price\": \"0\",
    \"cost_price\": \"0\"
}"' \
--form 'variants="{
    \"product_id\": \"0\",
    \"product_name\": \"m / đỏ\",
    \"product_code\": null,
    \"units\": [
        {
            \"product_barcode\": \"null\",
            \"price\": \"0\",
            \"old_price\": \"0\",
            \"cost_price\": \"0\",
            \"last_input_price\": \"0\",
            \"unit_name\": \"cái\",
            \"unit_exchange\": \"1\",
            \"is_primary\": \"true\"
        }
    ],
    \"last_input_price\": \"0\",
    \"cost_price\": \"0\"
}"' \
--form 'variants="{
    \"product_id\": \"0\",
    \"product_name\": \"l / đỏ\",
    \"product_code\": null,
    \"units\": [
        {
            \"product_barcode\": \"null\",
            \"price\": \"0\",
            \"old_price\": \"0\",
            \"cost_price\": \"0\",
            \"last_input_price\": \"0\",
            \"unit_name\": \"cái\",
            \"unit_exchange\": \"1\",
            \"is_primary\": \"true\"
        }
    ],
    \"last_input_price\": \"0\",
    \"cost_price\": \"0\"
}"' \
--form 'combo="[
    {
        \"title\": \"combo nước\",
        \"group_local_id\": \"17422693572593021570685368544\",
        \"select_type\": 1,
        \"max_choose\": 1,
        \"products\": [
            {
                \"local_id\": \"17422693869154621570685368413\",
                \"group_local_id\": \"17422693572593021570685368544\",
                \"product_master_id\": 1119256,
                \"product_id\": 1120566,
                \"name\": \"number 1\",
                \"product_type\": 1,
                \"quantity\": 1,
                \"price\": 0,
                \"unit_id\": 115691,
                \"unit_name\": \"chai\",
                \"unit_exchange\": 1,
                \"quantitative\": 1,
                \"product_master_unit\": [
                    {
                        \"id\": 1329639,
                        \"product_id\": 1120566,
                        \"product_master_id\": 1119256,
                        \"unit_id\": 115691,
                        \"unit_name\": \"chai\",
                        \"unit_exchange\": 1,
                        \"is_primary\": 1,
                        \"cost_price\": 0,
                        \"sell_flg\": 1,
                        \"product_barcode\": \"\",
                        \"available\": 1,
                        \"price\": 25000
                    }
                ],
                \"combo_price\": 25000,
                \"vat_price\": 0,
                \"hide_component\": false
            },
            {
                \"local_id\": \"17422693906354711570685368811\",
                \"group_local_id\": \"17422693572593021570685368544\",
                \"product_master_id\": 1119252,
                \"product_id\": 1120562,
                \"name\": \"Nutri\",
                \"product_type\": 1,
                \"quantity\": 1,
                \"repeat_type\": 0,
                \"price\": 0,
                \"editable_flg\": 0,
                \"unit_id\": 115691,
                \"unit_name\": \"chai\",
                \"unit_exchange\": 1,
                \"quantitative\": 1,
                \"product_master_unit\": [
                    {
                        \"id\": 1329636,
                        \"product_id\": 1120562,
                        \"product_master_id\": 1119252,
                        \"shop_id\": 1570685368,
                        \"unit_id\": 115691,
                        \"unit_name\": \"chai\",
                        \"unit_exchange\": 1,
                        \"is_primary\": 1,
                        \"cost_price\": 0,
                        \"product_material\": \"[]\",
                        \"sell_flg\": 1,
                        \"product_barcode\": \"\",
                        \"available\": 1,
                        \"old_price\": 0,
                        \"default_inventory_management_flg\": false,
                        \"price\": 25000
                    }
                ],
                \"combo_price\": 25000,
                \"vat_price\": 0,
                \"hide_component\": false
            }
        ]
    }
]"'

Responses

🟢200Success
application/json
Body

Example
{
    "data": {
        "shop_id": 1570685368,
        "product_master_id": 1120411,
        "product_master_root_id": 1120411,
        "product_name": "sản phẩm test 2",
        "short_name": null,
        "product_code": "SP06005",
        "product_barcode": null,
        "description": "Tạo mới SP1",
        "available": 1,
        "product_category_id": 19908,
        "product_tax": 0,
        "product_price": 20000,
        "last_input_price": 0,
        "primary_unit_id": 115674,
        "primary_unit_name": "cái",
        "product_thumbnail1": null,
        "product_thumbnail2": null,
        "product_thumbnail3": null,
        "product_thumbnail4": null,
        "status": 1,
        "reseller_flg": 0,
        "invalid": 0,
        "feature": "",
        "products": [
            {
                "shop_id": 1570685368,
                "product_id": 1121743,
                "product_root_id": 1121743,
                "product_master_id": 1120411,
                "product_name": "sản phẩm test 2",
                "short_name": null,
                "product_code": "SP06005",
                "product_master_code": "SP06005",
                "product_price": 1000,
                "product_tax": 0,
                "product_type": 1,
                "product_barcode": null,
                "product_category_id": 19908,
                "allow_overselling": 0,
                "inventory_management_flg": 1,
                "product_manufacturing_flg": 0,
                "automatically_create_inventory_items": 0,
                "alert_flg": 0,
                "alert_maxval": null,
                "alert_minval": null,
                "unit_id": 115674,
                "unit_name": "cái",
                "reseller_flg": 0,
                "invalid": 0,
                "order_index_product": 45,
                "allow_online_sale": 0,
                "regdate": "2025-03-18 10:23:35",
                "units": [
                    {
                        "id": 1331234,
                        "shop_id": 1570685368,
                        "product_master_id": 1120411,
                        "product_id": 1121743,
                        "unit_id": 115674,
                        "unit_name": "cái",
                        "unit_exchange": 1,
                        "price": 1000,
                        "cost_price": 0,
                        "alert_flg": null,
                        "is_primary": 1,
                        "sell_flg": 1,
                        "default_inventory_management_flg": false,
                        "regdate": "2025-03-18 10:23:35",
                        "last_price": null,
                        "last_pricedate": null,
                        "product_material": null,
                        "product_barcode": null,
                        "old_price": null,
                        "available": 1
                    }
                ]
            }
        ]
    },
    "msg": "",
    "angular_build_version": "82933025dee6ad6ea4d8"
}
Modified at 2025-08-26 01:51:55
Previous
Warehouse Import Schema
Next
Sửa một sản phẩm
Built with