如何透過Restful將資料更新到Notion中(notion Api)

JLin
Dec 28, 2023

--

步驟

  1. 申請inergtra api
    https://www.notion.so/my-integrations/

先建立以一個整合,並且取得api key,命名他,譬如 Test123

2. 在要使用的workspace 中透過右邊選單,先將該intergrations加入在connection 中選擇你的intergration加入才行

3.建立一個頁面,並且透過網址取得page id
譬如
https://www.notion.so/Test-84272888e465a80b2a1

id就是後面那串

84272888e465a80b2a1

4. 透過restful 執行

header


Authorization: Bearer secret_9Gw0uVHgleVbVgpr7ZfE
Notion-Version: 2022–06–28

content


{
“parent”: { “page_id”: “84271403e88e465a80b2a1” },
“properties”: {
“title”: {
“title”: [{ “type”: “text”, “text”: { “content”: “A note from your pals at Notion” } }]
}
},
“children”: [
{
“object”: “block”,
“type”: “paragraph”,
“paragraph”: {
“rich_text”: [{ “type”: “text”, “text”: { “content”: “You made this page using the Notion API. Pretty cool, huh? We hope you enjoy building with us.” } }]
}
}
]
}

如此就可以完成了

--

--

JLin

JAVA / Android /Kotlin / Kotlin Native 對於Kotlin衍生的JVM等技術 Compose for web / desktop / Ktor Server,或是生成式AI (Gemini/OpenAI)各式應用, 都有小興趣