检索同步块时缺少 属性 "children"
Property "children" is missing when retrieving synced block
概念 API 已支持 synced_block
。我正在使用概念 API 和 Next.js。根据docs and the changelog,输出应该包含这样的属性。
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"
}
}
]
}
}
]
}
}
到目前为止,我可以从参考同步块中得到原始同步块的block_id。
但是,原始同步块缺少 children
属性。我无法获取我创建的 synced_block 的内容。
只能检索 synced_from
属性。
"synced_block": {
"synced_from": null
}
尝试使用 Postman 并获得相同的结果。
在寻求 Notion 的支持后,我发现我误解了 API 文档。
简而言之,我将需要另一个 api 调用来检索子块,而不是检索块。
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.
使用 @notionhq/client
检索块的子块:
const response = await notion.blocks.children.list({
block_id: blockId,
});
概念 API 已支持 synced_block
。我正在使用概念 API 和 Next.js。根据docs and the changelog,输出应该包含这样的属性。
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"
}
}
]
}
}
]
}
}
到目前为止,我可以从参考同步块中得到原始同步块的block_id。
但是,原始同步块缺少 children
属性。我无法获取我创建的 synced_block 的内容。
只能检索 synced_from
属性。
"synced_block": {
"synced_from": null
}
尝试使用 Postman 并获得相同的结果。
在寻求 Notion 的支持后,我发现我误解了 API 文档。
简而言之,我将需要另一个 api 调用来检索子块,而不是检索块。
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.
使用 @notionhq/client
检索块的子块:
const response = await notion.blocks.children.list({
block_id: blockId,
});