Components

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

cURL

curl "https://api.storyblok.com/v1/spaces/133/components" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDMsInRpbWVzdGFtcCI6MTUyODY1MjM5OX0.Gby9Yv1r6Xf5JhsuIXeeQSLDPs2y1ZsAu8_uOLLZRm8" \

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

GET /v1/spaces/:space_id/components/:id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/132/components/15" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDIsInRpbWVzdGFtcCI6MTUyODY1MjM5OX0.-mQHWuvkaav1bj7z7dpDfpBbiEUBDES76rdgEcgK_QA" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-06-03T17:39:59.258Z",
    "id": 15,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Creating a component

Endpoint

POST /v1/spaces/:space_id/components

Parameters

Name Description
component[name] required Name of the component
component[schema] Schema of the component
component[image] Preview image
component[preview_field] Preview field
component[is_root] Is root
component[is_nestable] Is nestable

Request

cURL

curl "https://api.storyblok.com/v1/spaces/134/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDQsInRpbWVzdGFtcCI6MTUyODY1MjM5OX0.zfJnZ9R808O8syvo39FuVkl5g1Co_pmgCvNuD2fmBDw" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-06-03T17:39:59.361Z",
    "id": 16,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Updating a component

Endpoint

PUT /v1/spaces/:space_id/components/:id

Parameters

Name Description
component[name] required Name of the component
component[schema] Schema of the component
component[image] Preview image
component[preview_field] Preview field
component[is_root] Is root
component[is_nestable] Is nestable

Request

cURL

curl "https://api.storyblok.com/v1/spaces/135/components/17" -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.eyJ1c2VyX2lkIjoyMDUsInRpbWVzdGFtcCI6MTUyODY1MjM5OX0.-2xorxH9ZP89ub6RxzgJ8EaBjtLqfW8LuRzz9Hj-L1o" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-06-03T17:39:59.396Z",
    "id": 17,
    "schema": "{\"title\":{\"type\":\"text\"},\"hidden\":{\"type\":\"boolean\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Deleting a component

Endpoint

DELETE /v1/spaces/:space_id/components/:id

Request

cURL

curl "https://api.storyblok.com/v1/spaces/136/components/18" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDYsInRpbWVzdGFtcCI6MTUyODY1MjM5OX0.52CM1ypQexv2IqQTr0-BF7qBfncRJRGXrYvzBwMyIdY" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-06-03T17:39:59.445Z",
    "id": 18,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Documentation