Compontents

Getting a list of components

Endpoint

GET /v1/spaces/:space_id/components

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1119/components" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDUwLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDB9.hhc5484dzz8ZnrRy99-D22Bqd7PdvczXHTT41hMQF3A" \

Response

Body

{
  "components": [

  ]
}

Get a single component

Endpoint

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

Request

cURL

curl "https://api.storyblok.com/v1/spaces/1118/components/101" -X GET \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDQ5LCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDB9.HX620ZKuKey5CCLfVrBiVVTfi7WliTutam6_8yFP80s" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-01-02T20:47:20.529Z",
    "id": 101,
    "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
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/1120/components" -d '{"component":{"name":"teaser","schema":"{\"title\":{\"type\":\"text\"}}"}}' -X POST \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDUxLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDB9.E_ANVEecWY9m4qcfwZNxy-8kJ8W95ctzNHlGt0cCuq4" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-01-02T20:47:20.606Z",
    "id": 102,
    "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
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/1121/components/103" -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.eyJ1c2VyX2lkIjoyMDUyLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDB9.7zk0z3KG8-RVQHhBbCJihqsX32y4zSbY1hQPgGt3O3E" \

Response

Body

{
  "component": {
    "name": "teaser",
    "display_name": null,
    "created_at": "2018-01-02T20:47:20.630Z",
    "id": 103,
    "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/1122/components/104" -d '' -X DELETE \
	-H "Accept: application/json" \
	-H "Content-Type: application/json"
	-H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoyMDUzLCJ0aW1lc3RhbXAiOjE1MTU1MzA4NDB9.DinGWCiBMWHdStzYS0ZnlCdGCqi_IrSs7_9m204-C0k" \

Response

Body

{
  "component": {
    "name": "header",
    "display_name": null,
    "created_at": "2018-01-02T20:47:20.661Z",
    "id": 104,
    "schema": "{\"title\":{\"type\":\"text\"}}",
    "image": null,
    "preview_field": null,
    "is_root": false,
    "is_nestable": true
  }
}

Documentation