看起来API本身实际上支持使用
children
这将使标题成为切换标题。
只是我使用的包装JVM库不支持将子级设置为HeadingOne、HeadingTwo和HeadingThree块。
我为图书馆增加了一期,请参阅
https://github.com/seratch/notion-sdk-jvm/issues/45
。
通过纯API的工作示例(替换
YOUR_PAGE_ID
使用您的Notion页面id),并设置
NOTION_API_TOKEN
到您的Notion代币:
curl -X PATCH 'https://api.notion.com/v1/blocks/YOUR_PAGE_ID/children' \
-H 'Authorization: Bearer '"$NOTION_API_KEY"'' \
-H "Content-Type: application/json" \
-H "Notion-Version: 2022-02-22" \
--data '{
"children": [
{
"object": "block",
"type": "heading_2",
"heading_2": {
"rich_text": [{ "type": "text", "text": { "content": "Heading 2 from script (try 3)" } }],
"children": [
{
"object": "block",
"type": "paragraph",
"paragraph": {
"rich_text": [
{
"type": "text",
"text": {
"content": "Child in heading 2."
}
}
]
}
}
]
}
}
]
}'