- Tổng quan
- Thẻ PosApp
- Thông tin khác
- Webhook
- Sản phẩm
- Khuyến mãi
- Đăng ký tài khoản PosApp
Sửa khuyến mãi
Testing
Test Env
https://retail-api.posapp.vn/
Test Env
https://retail-api.posapp.vn/
POST
api/public/promotions/update
Request
Header Params
X-API-Key
string
optional
Body Params application/json
id
number
required
promotion_name
string
required
promotion_code
string
required
promotion_type
integer
required
promotion_subtype
integer
required
promotion_subtype2
integer
required
promotion_value
integer
required
start_date
string
required
end_date
string
required
started_at
integer
required
ended_at
integer
required
is_weekdays
integer
required
weekdays
string
required
1: Thứ hai,
2: Thứ ba,
3: Thứ tư,
4: Thứ năm,
5: Thứ sáu,
6: Thứ bảy,
0: Chủ nhật
Gửi lên dạng string: "0,1,2,3"
weeks
number
required
1: Tuần 1,
2: Tuần 2,
3: Tuần 3,
4: Tuần 4
is_time
integer
required
0: Mặc định tất cả khung giờ
1: Gửi thêm key promotion_time_slots để hệ thống kiểm tra điều kiện
promotion_time_slots
array[string]
required
target_type
integer
required
target_detailtype
array[string]
required
promotion_detail
array [object {5}]
required
foods
string
optional
food_id: là product_id của sản phẩm hoặc là category_id của danh mục
food_name: là tên sản phẩm hoặc tên danh mục
amount: là số lượng sản phẩm mặc định là 1
amount2: mặc định là 1
is_category: Nếu là danh mục thì là true, còn không thì là false
is_all: mặc định là false
unit_master_ids: Mảng object chứa các đơn vị tính của sản phầm bao gồm key
foods2
string
optional
is_category
boolean
optional
is_all
boolean
optional
unit_master_ids
string
optional
is_new
integer
required
promotion_desc
string
required
allow_apply_concurrent_flg
integer
required
Lưu ý: Gửi lên 1 là có và 0 là không
apply_all_branchs
integer
required
1: Áp dụng tất cả chi nhánh con
0: Gửi lên thêm branches_are_applicable
branches_are_applicable
array [object {2}]
required
include_children_branches
integer
required
include_progeny_branches
integer
required
Example
{
"id": 331,
"promotion_name": "Đồng giá 20k",
"promotion_code": "",
"promotion_type": 10,
"promotion_subtype": 1,
"promotion_subtype2": 0,
"promotion_value": 20000,
"start_date": "2025-03-18",
"end_date": "2025-03-26",
"started_at": 1742256000,
"ended_at": 1742947200,
"is_weekdays": 0,
"weekdays": "2,3,4",
"weeks": 3,
"is_time": 0,
"promotion_time_slots": null,
"target_type": 0,
"target_detailtype": "",
"promotion_detail": [
{
"foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]}]",
"foods2": "[]",
"is_category": false,
"is_all": false,
"unit_master_ids": "[{\"id\":115671,\"name\":\"ly\"},{\"id\":115671,\"name\":\"ly\"}]"
}
],
"is_new": 1,
"promotion_desc": "Khuyến mãi đồng giá 20k",
"allow_apply_concurrent_flg": 0,
"apply_all_branchs": 0,
"branches_are_applicable": [
{
"include_children_branches": 0,
"include_progeny_branches": 0
}
]
}
Request 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/promotions/update' \
--header 'X-API-Key;' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 331,
"promotion_name": "Đồng giá 20k",
"promotion_code": "",
"promotion_type": 10,
"promotion_subtype": 1,
"promotion_subtype2": 0,
"promotion_value": 20000,
"start_date": "2025-03-18",
"end_date": "2025-03-26",
"started_at": 1742256000,
"ended_at": 1742947200,
"is_weekdays": 0,
"weekdays": "2,3,4",
"weeks": 3,
"is_time": 0,
"promotion_time_slots": null,
"target_type": 0,
"target_detailtype": "",
"promotion_detail": [
{
"foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\"}]}]",
"foods2": "[]",
"is_category": false,
"is_all": false,
"unit_master_ids": "[{\"id\":115671,\"name\":\"ly\"},{\"id\":115671,\"name\":\"ly\"}]"
}
],
"is_new": 1,
"promotion_desc": "Khuyến mãi đồng giá 20k",
"allow_apply_concurrent_flg": 0,
"apply_all_branchs": 0,
"branches_are_applicable": [
{
"include_children_branches": 0,
"include_progeny_branches": 0
}
]
}'
Responses
🟢200Success
application/json
Body
status
number
required
error_code
number
required
data
object
required
msg
string
required
Example
{
"status": 1,
"error_code": 0,
"data": {
"id": 3102,
"shop_id": "1570685368",
"promotion_code": null,
"promotion_name": "Đồng giá 20k",
"promotion_desc": null,
"main_promotion_id": "0",
"promotion_type": "10",
"promotion_subtype": "1",
"promotion_max_price": "0",
"promotion_subtype2": "0",
"promotion_value": "20000",
"promotion_image": null,
"target_type": "0",
"target_detailtype": null,
"start_date": "2025-03-19",
"end_date": "2025-03-21",
"is_weekdays": "1",
"weekdays": "2,3",
"weeks": 2,
"promotion_time_slots": "[\"00:00 - 06:00\",\"21:00 - 00:00\"]",
"is_time": "1",
"start_time": null,
"to_time": null,
"condition_flag": "0",
"condition_detail": "0",
"promotion_extra_condition": null,
"promotion_subtype2_option": 0,
"lastupdate": "2025-03-18 14:36:12",
"branch_ids": "[1640557387,1129987154]",
"external_app_identifies": null,
"target_channel": "null",
"promotion_group_id": null,
"max_use": "0",
"count_used": 0,
"max_use_daily": "0",
"count_used_today": 0,
"max_use_per_customer": 0,
"online_flg": 0,
"auto_apply_flg": "0",
"allow_apply_concurrent_flg": "0",
"apply_on_original_price_flg": "1",
"status": 0,
"started_at": "1742342400",
"ended_at": "1742515200",
"collaborator_type": null,
"collaborator_percent": null,
"topping_flg": "0",
"reach_amount_flg": "0",
"minimum_quantity": "0",
"is_new": "1",
"gift_many_flg": "0",
"max_number_gift": "1",
"apply_all_branchs": "0",
"branches_are_applicable": [
{
"shop_id": 1640557387,
"shop_name": "Chi nhánh 1",
"start_date": "2025-03-19",
"end_date": "2025-03-21",
"is_weekdays": 1,
"weekdays": "0,1,2,3,4,5,6",
"is_time": 1,
"start_time": null,
"to_time": null,
"include_children_branches": 1,
"include_progeny_branches": 1,
"use_default_time_option": 1,
"updated_at": "2025-03-18 14:36:12",
"shop": {
"id": 1640557387,
"name": "Chi nhánh 1"
}
},
{
"shop_id": 1129987154,
"shop_name": "Chi nhánh 2",
"start_date": "2025-03-19",
"end_date": "2025-03-21",
"is_weekdays": 1,
"weekdays": "0,1,2,3,4,5,6",
"is_time": 1,
"start_time": null,
"to_time": null,
"include_children_branches": 1,
"include_progeny_branches": 1,
"use_default_time_option": 1,
"updated_at": "2025-03-18 14:36:12",
"shop": {
"id": 1129987154,
"name": "Chi nhánh 2"
}
}
],
"promotion_detail": [
{
"id": 19184,
"promotion_id": 3102,
"foods": "[{\"food_id\":1120500,\"food_name\":\"Nước ép thơm\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}],\"unit_master2_ids\":[]},{\"food_id\":1120501,\"food_name\":\"Nước ép dâu\",\"amount\":1,\"amount2\":1,\"is_category\":false,\"is_all\":false,\"unit_master_ids\":[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}],\"unit_master2_ids\":[]}]",
"unit_master_ids": "[{\"id\":115671,\"name\":\"ly\",\"plus_price\":0},{\"id\":115671,\"name\":\"ly\",\"plus_price\":0}]",
"food_id": 1120500,
"food_name": "\"Nước ép thơm\"",
"amount": 2,
"foods2": "[]",
"unit_master2_ids": "[]",
"food2_id": null,
"food2_name": null,
"amount2": 0,
"amount_used": 0,
"discount_type": 0,
"discount_value": 0,
"change_price": 0,
"is_category": 0,
"is_category2": 0,
"is_all": 0,
"is_all2": 0,
"combo_local_id": "0",
"combo_title": null,
"combo_price": null,
"parent_combo_local_id": "0",
"plus_price": 0,
"detail_max_price": null,
"detail_type": 0,
"combo_select_type": null,
"combo_max_choose": null,
"additional_condition": 0,
"topping_flg": 0,
"reach_amount_flg": 0,
"minimum_quantity": 0,
"combo_product_master_id": 0,
"combo_price_online": null
}
],
"promotion_codes": [],
"child_promotions": []
},
"msg": "Thành công",
"angular_build_version": "82933025dee6ad6ea4d8"
}
Modified at 2025-06-03 09:13:16