مرجع API
القوالب المستضافة
أنشئ مسودات المحتوى القابل لإعادة الاستخدام وولِّده للمعاينة واختبره وأصدِر نسخه وانشره وأرسله.
لا توجد عمليات تطابق عامل التصفية هذا.
GET
مفتاح API/templatesعرض القوالب المستضافة
عرض القوالب المستضافة
curl https://sendhq.cc/api/v1/templates \
-X GET \
-H "Authorization: Bearer $SENDHQ_API_KEY"{
"data": [],
"count": 0
}POST
مفتاح API/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/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/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/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/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/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/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/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/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"
}
}