Query Plugin DataBricks
Bricks
Read more in guide Working with Bricks.
Examples of queries to interact with data from the Bricks plugin.
Fetching Bricks data
This query fetches the Bricks data from a post (stored as meta under either entry _bricks_page_header_2
, _bricks_page_content_2
, or _bricks_page_footer_2
), keeping the structure of the data as stored in the DB:
{
post(by: { id: 1 }) {
bricksData
}
}
This query filters the Bricks data to only include elements with the name text
:
{
post(by: { id: 1 }) {
bricksData(filterBy: { include: ["text"] })
}
}
Updating Bricks data
This mutation merges specific elements in the Bricks data:
mutation {
bricksMergeCustomPostElementDataItem(input: {
customPostID: 1
elements: [
{
id: "ucuzdk",
settings: {
text: "Updated text"
}
}
]
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
customPost {
__typename
...on CustomPost {
id
bricksData
}
}
}
}
Next