Components

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

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

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

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

Request

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

Response

Body

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

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/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" \

Response

Body

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

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/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" \

Response

Body

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

Deleting a component

Endpoint

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

Request

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

Response

Body

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

Documentation