เทมเพลต: เวอร์ชัน
แสดงรายการเวอร์ชันเทมเพลต
เวอร์ชันที่บันทึกของเทมเพลต ล่าสุดก่อน เก็บไว้ 10 เวอร์ชันล่าสุด
https://g.sendcorex.com/v1/templatecommand: list_template_versionsต้องมีขอบเขต template:read บน API key ของคุณ
เทมเพลต HTML บันทึกเวอร์ชันทุกครั้งที่สร้างและอัปเดต เทมเพลตจากเอดิเตอร์บันทึกเวอร์ชันทุกครั้งที่คุณคลิกบันทึกในแดชบอร์ด (ไม่ใช่การบันทึกอัตโนมัติ)
อาร์กิวเมนต์
template_idstringจำเป็นเทมเพลต
เช่น
"html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93"
เริ่มต้นอย่างรวดเร็ว
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1/template',
{
commands: [
{
command: "list_template_versions",
args: {
template_id: "html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93"
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_API_KEY } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);การตอบกลับ
{
"type": "SUCCESS",
"results": [
{
"command": "list_template_versions",
"id": "0",
"type": "SUCCESS",
"took_ms": 4,
"data": {
"template_id": "html_5f2c8a10-3d4e-4b6f-9a71-2c8e0d4b7a93",
"versions": [
{
"version_at": "2026-10-21T04:15:40.902Z",
"html_size": 248,
"subject": "Welcome to Acme, {{first_name}}"
},
{
"version_at": "2026-10-21T04:09:12.004Z",
"html_size": 231,
"subject": "Welcome to Acme"
},
{
"version_at": "2026-10-21T04:02:11.310Z",
"html_size": 198,
"subject": null
}
]
}
}
]
}ฟิลด์การตอบกลับ
template_idเทมเพลต
versionsล่าสุดก่อน ว่างเมื่อยังไม่ได้บันทึกอะไร
versions[].version_atเวลาที่บันทึกเวอร์ชัน ส่งค่านี้ตามเดิมให้ Restore Template Version
versions[].html_sizeขนาด HTML ของเวอร์ชันนั้น เป็นไบต์
versions[].subjectหัวเรื่องของเวอร์ชันนั้น หรือ
null
ข้อผิดพลาด
ข้อผิดพลาดระดับ HTTP ส่งกลับ type, code และ message ข้อผิดพลาดที่มีเครื่องหมาย CMD จะกลับมาในผลลัพธ์ของคำสั่ง พร้อม HTTP 200
- 401
INVALID_API_KEYAPI key ไม่มีอยู่ ถูกเพิกถอน หรือถูกปิดในแดชบอร์ด
- 429
RATE_LIMITEDเกิน 15 คำขอ/วินาที หรือ 15 คำขอพร้อมกันสำหรับ IP + API key เดียวกัน รอจำนวนวินาทีใน Retry-After
- CMD
MISSING_SCOPEAPI key ไม่มีขอบเขตที่คำสั่งนี้ต้องการ
- CMD
INVALID_ARGSอาร์กิวเมนต์ไม่ถูกต้อง: `template_id` รูปแบบผิด ไม่มี `name` หรือ `html` ชื่อยาวเกิน 255 ตัวอักษร `version_at` ที่ไม่ใช่ RFC 3339…
- CMD
TEMPLATE_NOT_FOUNDเทมเพลตไม่อยู่ในบัญชีของคุณ
- CMD
INTERNALข้อผิดพลาดของเซิร์ฟเวอร์ รายละเอียดเขียนเฉพาะในล็อกเซิร์ฟเวอร์