Block anhängen
POST
/pages/{page}/blocks
const url = 'https://ihre-marke.brandhub.31m.de/api/v1/pages/1/blocks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"type":"example","data":{"additionalProperty":"example"}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://ihre-marke.brandhub.31m.de/api/v1/pages/1/blocks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "type": "example", "data": { "additionalProperty": "example" } }'Hängt einen Block ans Seitenende und liefert die vollständige Seite mit der neuen Block-ID. Brandhub prüft den Block wie der Editor im Backend. Unbekannte Typen enden mit 422, unbekannte Felder verwirft die API, HTML bereinigt sie.
Authorizations
Abschnitt betitelt „Authorizations“Parameters
Abschnitt betitelt „Parameters“Path Parameters
Abschnitt betitelt „Path Parameters“page
required
integer
ID der Seite.
Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“Media typeapplication/json
object
type
required
Block-Typ, zum Beispiel heading, rich_text oder alert.
string
data
Felder des Blocks, je nach Typ.
object
key
additional properties
Examplegenerated
{ "type": "example", "data": { "additionalProperty": "example" }}Responses
Abschnitt betitelt „Responses“Page
Media typeapplication/json
Page
object
id
required
integer
title
required
string
slug
required
string
type
required
string
parent_id
required
integer | null
nav_expansion
required
string
visibility
required
string
blocks
required
Array<object>
object
id
required
string | null
type
required
string | null
data
required
object
key
additional properties
updated_at
required
string | null
Examplegenerated
{ "id": 1, "title": "example", "slug": "example", "type": "example", "parent_id": 1, "nav_expansion": "example", "visibility": "example", "blocks": [ { "id": "example", "type": "example", "data": { "additionalProperty": "example" } } ], "updated_at": "example"}