Danh mục sản phẩm
· 8 endpoint
- GET/accounts/{accountId}/zalo/catalogs
- POST/accounts/{accountId}/zalo/catalogs
- GET/accounts/{accountId}/zalo/catalogs/{catalogId}/products
- POST/accounts/{accountId}/zalo/catalogs/{catalogId}/products
- DELETE/accounts/{accountId}/zalo/catalogs/{catalogId}/products
- PATCH/accounts/{accountId}/zalo/catalogs/{catalogId}
- DELETE/accounts/{accountId}/zalo/catalogs/{catalogId}
- PATCH/accounts/{accountId}/zalo/catalogs/{catalogId}/products/{productId}
Danh mục sản phẩm của tài khoản Zalo Business
GET
/api/v1/accounts/{accountId}/zalo/catalogsScope: chat:readĐọc từ Zalo theo trang. url = link catalog.zalo.me để gửi vào hội thoại (route gửi link).
Tham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
pagequery · tuỳ chọn | integer ≥ 0 · default 0 | |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 50 · default 20 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs" \
-H "Authorization: Bearer dpk_xxx"Tạo danh mục sản phẩm Zalo Business
POST
/api/v1/accounts/{accountId}/zalo/catalogsScope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | ID tài khoản (accounts.zalo_id). Facebook dùng Facebook ID, Telegram dùng ID tài khoản Telegram. |
Body (JSON)
namebắt buộc | string max 200 |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string"}'Sản phẩm trong một danh mục Zalo Business
GET
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/productsScope: chat:readĐọc từ Zalo theo trang. Mỗi sản phẩm có url (catalog.zalo.me) để gửi vào hội thoại.
Tham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | ID danh mục |
pagequery · tuỳ chọn | integer ≥ 0 · default 0 | |
limitquery · tuỳ chọn | integer ≥ 1 · ≤ 100 · default 100 |
Lệnh mẫu
bash
curl "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/products" \
-H "Authorization: Bearer dpk_xxx"Thêm sản phẩm vào danh mục Zalo Business
POST
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/productsScope: crm:writeẢnh: photos (link đã có trên Zalo) và / hoặc photo_files (ảnh mới, Deplao tải lên Zalo trước).
Tham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | ID danh mục |
Body (JSON)
namebắt buộc | string max 200 | |
pricebắt buộc | string max 30 | Giá, chỉ số (VNĐ), vd "150000" |
descriptiontuỳ chọn | string max 2000 | |
photostuỳ chọn | string[] max 5 items | URL ảnh đã có trên Zalo (vd ảnh của sản phẩm khác), giữ đúng thứ tự |
photo_filestuỳ chọn | object[] max 5 items | Ảnh mới: mỗi mục đúng một trong upload_id, library_uuid, url. Deplao tải lên Zalo trước rồi xếp sau photos. Tổng photos + photo_files tối đa 5 |
└upload_idtuỳ chọn | string | ID từ POST /media/uploads |
└library_uuidtuỳ chọn | string | UUID ảnh trong thư viện media |
└urltuỳ chọn | string (uri) | Link ảnh http/https công khai, server tự tải về |
Lệnh mẫu
bash
curl -X POST "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/products" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","price":"string","description":"string"}'Xoá sản phẩm khỏi danh mục Zalo Business
DELETE
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/productsScope: crm:writeXoá trên Zalo, không hoàn tác: gửi confirm=true.
Tham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | ID danh mục |
Body (JSON)
product_idsbắt buộc | string[] max 100 items | |
confirmtuỳ chọn | boolean default false |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/products" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"product_ids":[],"confirm":false}'Đổi tên danh mục sản phẩm Zalo Business
PATCH
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}Scope: crm:writeTham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | ID danh mục |
Body (JSON)
namebắt buộc | string max 200 |
Lệnh mẫu
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string"}'Xoá danh mục sản phẩm Zalo Business
DELETE
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}Scope: crm:writeXoá cả sản phẩm trong danh mục trên Zalo, không hoàn tác: gửi confirm=true.
Tham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | ID danh mục |
confirmquery · tuỳ chọn | boolean default false | Phải là true |
Lệnh mẫu
bash
curl -X DELETE "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}" \
-H "Authorization: Bearer dpk_xxx"Sửa sản phẩm trong danh mục Zalo Business
PATCH
/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/products/{productId}Scope: crm:writeGửi đủ tên, giá, mô tả, ảnh (như form sửa của app) và created_at của sản phẩm (từ danh sách sản phẩm). Ảnh giữ lại: photos; ảnh mới: photo_files.
Tham số
accountIdpath · bắt buộc | string max 200 | |
catalogIdpath · bắt buộc | string max 200 | |
productIdpath · bắt buộc | string max 200 | ID sản phẩm |
Body (JSON)
namebắt buộc | string max 200 | |
pricebắt buộc | string max 30 | Giá, chỉ số (VNĐ), vd "150000" |
descriptiontuỳ chọn | string max 2000 | |
photostuỳ chọn | string[] max 5 items | URL ảnh đã có trên Zalo (vd ảnh của sản phẩm khác), giữ đúng thứ tự |
photo_filestuỳ chọn | object[] max 5 items | Ảnh mới: mỗi mục đúng một trong upload_id, library_uuid, url. Deplao tải lên Zalo trước rồi xếp sau photos. Tổng photos + photo_files tối đa 5 |
└upload_idtuỳ chọn | string | ID từ POST /media/uploads |
└library_uuidtuỳ chọn | string | UUID ảnh trong thư viện media |
└urltuỳ chọn | string (uri) | Link ảnh http/https công khai, server tự tải về |
created_atbắt buộc | integer ≥ 0 | created_at của sản phẩm (ms) |
Lệnh mẫu
bash
curl -X PATCH "http://127.0.0.1:9900/api/v1/accounts/{accountId}/zalo/catalogs/{catalogId}/products/{productId}" \
-H "Authorization: Bearer dpk_xxx" \
-H "Content-Type: application/json" \
-d '{"name":"string","price":"string","created_at":0}'