如何通过Notion API为页面添加描述并配置请求体内容?
如何在Notion API请求体中添加页面内容
你需要在请求体的根层级添加children字段,这个字段用于定义页面的具体内容(由各种内容块组成),而不是你尝试的description字段——Notion API并没有这个用于页面内容的字段,所以会报错。
修改后的完整请求体示例
{ "parent": { "database_id": "<id>" }, "properties": { "Name": { "title": [ { "text": { "content": "New note" } } ] }, "Param 1": { "rich_text": [ { "text": { "content": "A dark green leafy vegetable" } } ] }, "Param 2": { "rich_text": [ { "text": { "content": "A dark green leafy vegetable" } } ] }, "Param 3": { "rich_text": [ { "text": { "content": "A dark green leafy vegetable" } } ] } }, "children": [ { "object": "block", "type": "paragraph", "paragraph": { "rich_text": [ { "type": "text", "text": { "content": "这是页面的第一段内容,可以是普通文本。" } } ] } }, { "object": "block", "type": "heading_2", "heading_2": { "rich_text": [ { "type": "text", "text": { "content": "二级标题示例" } } ] } }, { "object": "block", "type": "bulleted_list_item", "bulleted_list_item": { "rich_text": [ { "type": "text", "text": { "content": "无序列表项1" } } ] } } ] }
关键说明
children是根级字段,和parent、properties同级,值为数组,每个元素对应一个页面内容块- 每个块需要指定
object: "block"和对应的type(比如paragraph、heading_2、bulleted_list_item等),不同类型的块有不同的结构 - 你可以根据需求添加更多类型的块,比如代码块、引用块、图片等,只要符合Notion API的块结构规范
内容的提问来源于stack exchange,提问作者Сергей Харитонов
相关产品推荐
相关产品推荐

