In the next Post in my Notion Series, I will show you how to add a Page to a Notion Database using the API and PowerShell.
Notion Blog Posts
– Work with NOTION API and PowerShell – TechGuy
– Pagination with Notion API and PowerShell – TechGuy
In My Case, this is a Task in my “Getting Things Done” Database where all my Epics, Projects, and Tasks are stored. So make sure you change your Properties accordingly to your Database.
The PowerShell Script to create a Notion Page
$NotionAPIKey = "your API Key"
$Notionheaders = @{
"Authorization" = "Bearer $($NotionAPIKey)"
"Content-type" = "application/json"
"Notion-Version" = "2021-08-16"
}
$DatabaseID = "your Database ID"
$JsonBody = @"
{
"parent" :{"database_id":"$DatabaseID"},
"properties":{
"Name":{
"title":[{
"text":{"content": "This is a Test Task" }
}
]
},
"Type": {
"select": {
"id": "3f806034-9c48-4519-871e-60c9c32d73d8"
}
},
"Status": {
"select": {
"id": "ab01bfb1-1102-4701-af06-c3f33e74d398"
}
}
}
}
"@
$Return = Invoke-RestMethod -Uri "https://api.notion.com/v1/pages" -Method POST -Headers $Notionheaders -Body $JsonBody
The Result looks like this
Github
All Notion examples can be found in my GitHub Repo: Seidlm/NOTION-PowerShell: PowerShell Scripts to work with NOTION (github.com)
Michael Seidl, aka Techguy
au2mate, everything