Compontents

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1038/components" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNTkwLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MTR9.NTTo6Qu2WMI1sFgbkHEA1okg1fqwjCI5OWSmLMppBts" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1037/components/51" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNTg5LCJ0aW1lc3RhbXAiOjE1MTEwNzk1MTR9.xbYWarYaGSFR3_Q8sFzBEg06oC0twXXDl-pgayU5GKs" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2017-11-12T08:18:34.237Z",
    "id": 51,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true
  }
}

Creating a component

Endpoint

POST /v1/spaces/:space_id/components

Parameters

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1039/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNTkxLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MTR9.E_pThjOdGBtdPEhog8jUPoPP1M5KXiS8zv-z08qthnQ" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2017-11-12T08:18:34.320Z",
    "id": 52,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true
  }
}

Updating a component

Endpoint

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

Parameters

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1040/components/53" -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.eyJ1c2VyX2lkIjoxNTkyLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MTR9.74WevIHmlqqlCmfyQG7BiizoiOCABfv-QHTTzy35Do4" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2017-11-12T08:18:34.349Z",
    "id": 53,
    "schema": "{\"title\":{\"type\":\"text\"},\"hidden\":{\"type\":\"boolean\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true
  }
}

Deleting a component

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1041/components/54" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json" \
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxNTkzLCJ0aW1lc3RhbXAiOjE1MTEwNzk1MTR9.DaUoJ9SAUfF8I6jklSsUeXrMIb021-TEP9O6mgTz-qs" \
	-H "Host: example.org" \
	-H "Cookie: "

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2017-11-12T08:18:34.383Z",
    "id": 54,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true
  }
}

Documentation