エンドポイント
エンドポイントの一覧
パスはhttps://api.kumidana.com/v1/<サイトのスラッグ> からの/ はAuthorization: Bearer <API トークン> がtype:read、form:read、entry:read で
| メソッド | パス | 返すもの |
|---|---|---|
| GET | /types |
種類の{ items: [...] } |
| GET | /types/<種類のキー> |
1 つの |
| GET | /content/<種類のキー> |
collection は |
| GET | /content/<種類のキー>/<ID またはスラッグ> |
1 件の |
| GET | /forms/<フォームのキー> |
公開して |
| POST | /forms/<フォームのキー>/submissions |
フォームの |
| PUT | /media |
画像の |
このhttps://api.kumidana.com/schema/typedef.json で/v1/<サイトのスラッグ> のtypes/*.json)を
GET 以外の
種類の定義を読む
GET /types は、/types/<キー> でも
curl https://api.kumidana.com/v1/docs/types/glossary \
-H "Authorization: Bearer kmd_pub_xxxx"{
"key": "glossary",
"name": "用語集",
"kind": "collection",
"titleField": "term",
"slugField": "slug",
"sort": { "field": "reading", "order": "asc" },
"fields": [
{ "key": "term", "label": "用語", "type": "text", "required": true },
{ "key": "slug", "label": "スラッグ", "type": "slug", "required": true },
{ "key": "reading", "label": "読み", "type": "text", "indexed": true, "phraseBreak": false }
]
}返るのは、indexed をunique のslugField の
エントリーの一覧を読む
GET /content/<種類のキー> は、items にtotal にlimit とoffset に
curl "https://api.kumidana.com/v1/docs/content/changelog?limit=5" \
-H "Authorization: Bearer kmd_pub_xxxx"const res = await fetch(`${BASE}/content/changelog?limit=5`, { headers });
const { items, total, limit, offset } = await res.json();並べ替え、
1 件を読む
GET /content/<種類のキー>/<ID またはスラッグ> は、items など)は
curl https://api.kumidana.com/v1/docs/content/docs/api-overview \
-H "Authorization: Bearer kmd_pub_xxxx"ID はdepth とfields が
single の種類を読む
kind がsite など)は、/content/<種類のキー> が、
curl https://api.kumidana.com/v1/docs/content/site \
-H "Authorization: Bearer kmd_pub_xxxx"まだ
single の/content/<種類のキー>/<ID またはスラッグ> で{type}、{id} は、/content/{type}/{id} に
フォームの定義を読む
GET /forms/<フォームのキー> は、
curl https://api.kumidana.com/v1/docs/forms/feedback \
-H "Authorization: Bearer kmd_pub_xxxx"見つからなければ
応答の
{
"key": "feedback",
"name": "フィードバック",
"fields": [
{ "key": "email", "label": "メールアドレス", "type": "email", "required": true },
{ "key": "message", "label": "内容", "type": "textarea", "required": true, "options": { "maxLength": 2000 } }
],
"successMessage": "ありがとうございました。",
"turnstile": { "enabled": true, "sitekey": "0x4AAAAAAA..." }
}fields のkey、label、type(text、textarea、email、url、number、select、checkbox、date)、required(省略可)、help(省略可)、options(省略可。maxLength、min、max、integer、choices)です。successMessage は、turnstile.enabled は、turnstile のfalse のsitekey がnull です。enabled がtrue でも、sitekey がnull に