Lấy dữ liệu mẫu của template
GET/zns/template/sample-dataVia 360: GET https://partner.quantri360.com/v1/zalo/zns/template/sample-data
Description
API Lấy dữ liệu mẫu của Template — Quyền cần có: Quản lý Message Template
Request
Endpoint
GET https://partner.quantri360.com/v1/zalo/zns/template/sample-data
Authentication & shop
| Name | In | Type | Sample | Description |
|---|---|---|---|---|
| Authorization | header | header | Bearer q360_live_ab12cd34_… | Khóa API của brand (tạo ở mục API key). Bắt buộc với mọi request. Brand suy từ key — không truyền mã brand. |
| platform_shop_id | query | string | 1173478676788457425 | OA_ID của Zalo OA brand đã nối (GET /v1/platforms). Mỗi brand một OA — có thể bỏ. |
| data | query | string (JSON) | {"offset":0,"count":10} | Nhiều API GET của Zalo nhận tham số gói trong data là chuỗi JSON — gửi nguyên như tài liệu Zalo. |
Request parameters
| Name | In | Type | Required | Sample | Description |
|---|---|---|---|---|---|
| template_id | query | string | Yes | ID của template cần lấy thông tin. |
Request examples
curl -s "https://partner.quantri360.com/v1/zalo/zns/template/sample-data?template_id=" \ -H "Authorization: Bearer $KEY"
Python
import requests
KEY = "q360_live_..." # khóa API của brand
r = requests.get(
"https://partner.quantri360.com/v1/zalo/zns/template/sample-data",
params={
"template_id": ""
},
headers={"Authorization": f"Bearer {KEY}"},
timeout=60,
)
print(r.status_code)
print(r.json())Node.js
const KEY = 'q360_live_...'; // khóa API của brand
const url = new URL('https://partner.quantri360.com/v1/zalo/zns/template/sample-data');
for (const [k, v] of Object.entries({"template_id":""})) url.searchParams.set(k, typeof v === 'object' ? JSON.stringify(v) : String(v));
const r = await fetch(url, {
method: 'GET',
headers: { Authorization: `Bearer ${KEY}` },
});
console.log(r.status, await r.json());PHP
<?php $key = 'q360_live_...'; // khóa API của brand $url = 'https://partner.quantri360.com/v1/zalo/zns/template/sample-data' . '?' . http_build_query(['template_id' => '']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer ' . $key]); $res = curl_exec($ch); $status = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); echo $status, "\n", $res;
Response
Response fields (as returned by Zalo OA)
| Name | Type | Sample | Description |
|---|---|---|---|
| error | int | 0 = thành công; khác 0 xem `message` (Zalo trả HTTP 200 kèm mã lỗi). | |
| message | string | Thông điệp của Zalo. | |
| data | object | Chứa tham số và dữ liệu mẫu của template bạn cần truy xuất. |
Response sample
{
"message": "Success",
"data": {
"balance_debt": 2000,
"due_date": "01/01/1970",
"number_debt": 2000,
"customer_name": "customer_name_sample"
},
"error": 0
}
Get started
- Sign up for Partner
- Enable a data type of the ZNS (Zalo Notification Service) group on the platform page
- Create an API key (tick the Zalo OA channel)
- Call it as in the examples above