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"
}
}