Notion API has supported synced_block
. I am using the Notion API with Next.js. According to the docs and the changelog, the output should contain such properties.
This is an example of an "original" synced_block. Note that all of the blocks available to be synced in another synced_block are captured in the children property.
{
"type": "synced_block",
"synced_block": {
"synced_from": null,
"children": [
{
"callout": {
"text": [
{
"type": "text",
"text": {
"content": "Callout in synced block"
}
}
]
}
}
]
}
}
So far, I can get the block_id of the original synced block from the reference synced block.
However, the children
property is missing for the original synced block. I cannot get the content of the synced_block that I created.
Only the synced_from
property can be retrieved.
"synced_block": {
"synced_from": null
}
Tried with Postman and get the same result.
After reaching for the support from Notion, I found that I misunderstood the API documentation.
Briefly, instead of retrieving a block, I will need another api call to retrieve the block children.
If you need to retrieve the children of the synced block you can use the "Retrieve block children" endpoint here in the documentation. This will return information on the content inside the synced block.
To retrieve children of a block using @notionhq/client
:
const response = await notion.blocks.children.list({
block_id: blockId,
});