Components

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

cURL

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

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/883/components/57" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNzQxLCJ0aW1lc3RhbXAiOjE1MzkzMzM5NzN9.3OegfTiC-tADIqvsfVXaZiz72z6Pigzl9lAXyIwCLfs" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-10-05T08:46:13.560Z",
    "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/885/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNzQzLCJ0aW1lc3RhbXAiOjE1MzkzMzM5NzN9.DHSM5HRv5UCjK9t8EP8DOawiQ92ysoVwqSdMpDNdI6g" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-10-05T08:46:13.655Z",
    "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/886/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.eyJ1c2VyX2lkIjoxNzQ0LCJ0aW1lc3RhbXAiOjE1MzkzMzM5NzN9.aKQk64U32LauRGHygo4k0gxrPlEaVzFOvdsEegqALBs" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-10-05T08:46:13.691Z",
    "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/887/components/60" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNzQ1LCJ0aW1lc3RhbXAiOjE1MzkzMzM5NzN9.YFTG49gPqHK8dUGNBdZW_ud3L-OLjAKARtktgT0Xus4" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-10-05T08:46:13.740Z",
    "id": 60,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Documentation