API reference
เทมเพลตแบบโฮสต์
ร่าง เรนเดอร์ ทดสอบ กำหนดเวอร์ชัน เผยแพร่ และส่งเนื้อหาที่นำกลับมาใช้ซ้ำได้
ไม่มีรายการที่ตรงกับตัวกรองนี้
GET
API key/templatesแสดงรายการเทมเพลตแบบโฮสต์
แสดงรายการเทมเพลตแบบโฮสต์
curl https://sendhq.cc/api/v1/templates \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"data": [],
"count": 0
}POST
API key/templatesสร้างเทมเพลตแบบโฮสต์
สร้างเทมเพลตแบบโฮสต์
curl https://sendhq.cc/api/v1/templates \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"Account welcome","key":"account-welcome","starter":"welcome"}'{
"template": {
"id": "tmpl_…",
"key": "account-welcome"
}
}GET
API key/templates/:idดึงฉบับร่าง รุ่นที่เผยแพร่ และการใช้งาน
ดึงฉบับร่าง รุ่นที่เผยแพร่ และการใช้งาน
curl https://sendhq.cc/api/v1/templates/id_value \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"template": {
"id": "tmpl_…"
},
"versions": [],
"draft": null,
"activeVersion": null,
"usage": []
}PUT
API key/templates/:id/draftบันทึกฉบับร่างของเทมเพลตอัตโนมัติ
บันทึกฉบับร่างของเทมเพลตอัตโนมัติ
curl https://sendhq.cc/api/v1/templates/id_value/draft \
-X PUT \
-H "Authorization: Bearer $SENDHQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"revision":1,"name":"Account welcome","subjectTemplate":"Welcome, {{first_name}}","htmlTemplate":"<h1>Welcome, {{first_name}}</h1>","textTemplate":"Welcome, {{first_name}}","variables":[{"key":"first_name","type":"string","required":true}],"sampleData":{"first_name":"Asha"}}'{
"draft": {
"id": "tmplv_…",
"revision": 2
}
}POST
API key/templates/:id/draftสร้างฉบับร่างใหม่จากรุ่นที่เผยแพร่
สร้างฉบับร่างใหม่จากรุ่นที่เผยแพร่
curl https://sendhq.cc/api/v1/templates/id_value/draft \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"draft": {
"id": "tmplv_…",
"revision": 1
}
}POST
API key/templates/:id/renderเรนเดอร์ผลลัพธ์จริงจากเซิร์ฟเวอร์
เรนเดอร์ผลลัพธ์จริงจากเซิร์ฟเวอร์
curl https://sendhq.cc/api/v1/templates/id_value/render \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"data":{"first_name":"Asha"}}'{
"subject": "Welcome, Asha",
"html": "<h1>Welcome, Asha</h1>",
"text": "Welcome, Asha",
"findings": []
}POST
API key/templates/:id/testส่งสแนปชอตทดสอบ
ส่งสแนปชอตทดสอบ
curl https://sendhq.cc/api/v1/templates/id_value/test \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"to":["owner@example.com"],"from":"hello@example.com","data":{"first_name":"Asha"}}'{
"id": "em_…",
"isTest": true
}POST
API key/templates/:id/publishเผยแพร่รุ่นเทมเพลตที่แก้ไขไม่ได้
เผยแพร่รุ่นเทมเพลตที่แก้ไขไม่ได้
curl https://sendhq.cc/api/v1/templates/id_value/publish \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"version": {
"id": "tmplv_…",
"state": "published"
}
}POST
API key/templates/:id/archiveเก็บถาวรเทมเพลต
เก็บถาวรเทมเพลต
curl https://sendhq.cc/api/v1/templates/id_value/archive \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"template": {
"id": "tmpl_…",
"lifecycle": "archived"
}
}POST
API key/templates/:id/restoreกู้คืนเทมเพลตที่เก็บถาวร
กู้คืนเทมเพลตที่เก็บถาวร
curl https://sendhq.cc/api/v1/templates/id_value/restore \
-X POST \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"template": {
"id": "tmpl_…",
"lifecycle": "active"
}
}