コンポーネント
コンポーネントのリストを取得
エンドポイント
GET /v1/spaces/:space_id/components
リクエスト
cURL
curl "https://api.storyblok.com/v1/spaces/587/components" -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json"
-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4MzQsInRpbWVzdGFtcCI6MTUzMjY4MDQ4Mn0.1Gdn4n4sP3R_NICZ2iwGwt5Pn5SSe2RN4HkaifbN43w" \
レスポンス
ボデイ
{
"components": [
]
}
コンポーネント単位で取得
エンドポイント
GET /v1/spaces/:space_id/components/:id
リクエスト
cURL
curl "https://api.storyblok.com/v1/spaces/586/components/57" -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json"
-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4MzMsInRpbWVzdGFtcCI6MTUzMjY4MDQ4Mn0.x6rJ6m8OJKHk5kDVt38NBokgwTaUQ8O5AVWhTWW3nnI" \
レスポンス
ボディ
{
"component": {
"name": "header",
"display_name": null,
"created_at": "2018-07-20T08:34:42.482Z",
"id": 57,
"schema": "{\"title\":{\"type\":\"text\"}}",
"image": null,
"preview_field": null,
"is_root": false,
"is_nestable": true,
"all_presets": [
],
"preset_id": null
}
}
コンポーネントの作成
エンドポイント
POST /v1/spaces/:space_id/components
パラメータ
名前 | 説明 |
---|---|
component[name](必須) | コンポーネントの名前 |
component[schema] | コンポーネントのスキーマ |
component[image] | プレビューイメージ |
component[preview_field] | プレビューフィールド |
component[is_root] | ルートである |
component[is nestable] | ネスト可能である |
リクエスト
cURL
curl "https://api.storyblok.com/v1/spaces/588/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json"
-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4MzUsInRpbWVzdGFtcCI6MTUzMjY4MDQ4Mn0.IWklTdtjjDGXvgwxzOyP3GpkQn1EYS_vvsAFyoW03Pw" \
リクエスト
ボディ
{
"component": {
"name": "teaser",
"display_name": null,
"created_at": "2018-07-20T08:34:42.571Z",
"id": 58,
"schema": "{\"title\":{\"type\":\"text\"}}",
"image": null,
"preview_field": null,
"is_root": false,
"is_nestable": true,
"all_presets": [
],
"preset_id": null
}
}
コンポーネントの更新
エンドポイント
PUT /v1/spaces/:space_id/components/:id
パラメータ
名前 | 説明 |
---|---|
component[name](必須) | コンポーネントの名前 |
component[schema] | コンポーネントのスキーマ |
component[image] | プレビューイメージ |
component[preview_field] | プレビューフィールド |
component[is_root] | ルートである |
component[is nestable] | ネスト可能である |
リクエスト
cURL
curl "https://api.storyblok.com/v1/spaces/589/components/59" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"},\"hidden\":{\"type\":\"boolean\"}}"}}' -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json"
-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4MzYsInRpbWVzdGFtcCI6MTUzMjY4MDQ4Mn0.NiUJZZJiOfauJFL-VAbas7vkv1avko8Bwc3vx0MceZE" \
レスポンス
ボディ
{
"component": {
"name": "teaser",
"display_name": null,
"created_at": "2018-07-20T08:34:42.603Z",
"id": 59,
"schema": "{\"title\":{\"type\":\"text\"},\"hidden\":{\"type\":\"boolean\"}}",
"image": null,
"preview_field": null,
"is_root": false,
"is_nestable": true,
"all_presets": [
],
"preset_id": null
}
}
コンポーネントの削除
エンドポイント
DELETE /v1/spaces/:space_id/components/:id
リクエスト
cURL
curl "https://api.storyblok.com/v1/spaces/590/components/60" -d '' -X DELETE \
-H "Accept: application/json" \
-H "Content-Type: application/json"
-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo4MzcsInRpbWVzdGFtcCI6MTUzMjY4MDQ4Mn0.t6-N2XI7c0dy4aswBK0SkRJNxDNB9k8SkO9gn3SDEo4" \
レスポンス
ボディ
{
"component": {
"name": "header",
"display_name": null,
"created_at": "2018-07-20T08:34:42.654Z",
"id": 60,
"schema": "{\"title\":{\"type\":\"text\"}}",
"image": null,
"preview_field": null,
"is_root": false,
"is_nestable": true,
"all_presets": [
],
"preset_id": null
}
}