Components

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

cURL

curl "https://api.storyblok.com/v1/spaces/654/components" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMDc3LCJ0aW1lc3RhbXAiOjE1NDI0Njg3OTR9.TpNTcyzX23dzB4Uj59e-UMyFXEHWvHfMnH2LubAuQIc" \

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/653/components/57" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMDc2LCJ0aW1lc3RhbXAiOjE1NDI0Njg3OTR9.hNIATJgI5KCYNVqDmAmMvoC-eOvRqLAW8TzPej05WCs" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-11-10T15:33:14.073Z",
    "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/655/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMDc4LCJ0aW1lc3RhbXAiOjE1NDI0Njg3OTR9.9czbAql2KQsRiizSgXEsycBnXxV-ogyvmmDO_GhNQ8U" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-11-10T15:33:14.276Z",
    "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/656/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.eyJ1c2VyX2lkIjoxMDc5LCJ0aW1lc3RhbXAiOjE1NDI0Njg3OTR9.i9NA3pyA5b9eZzmOpmPS0eYezRHi8dZeZFYtpqb9hak" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-11-10T15:33:14.344Z",
    "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/657/components/60" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxMDgwLCJ0aW1lc3RhbXAiOjE1NDI0Njg3OTR9.Rsz3x4tTdEW54Rcsy8BlKmHjp6FiEuzFOJtS-RlrdOY" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-11-10T15:33:14.462Z",
    "id": 60,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true,
    "all_presets": [

    ],
    "preset_id": null
  }
}

Documentation