Get all pages title and url in Notion API
To generate sitemap.xml for a Notion based website, list of all shared with integration pages and urls are needed.
curl -s -X POST 'https://api.notion.com/v1/search' \
-H 'Authorization: Bearer '"$NOTION_API_KEY"'' \
-H 'Content-Type: application/json' \
-H 'Notion-Version: 2022-06-28' \
--data '{
"filter": {
"value": "page",
"property": "object"
},
"sort":{
"direction":"descending",
"timestamp":"last_edited_time"
}
}'
Reference
https://developers.notion.com/reference/post-search
https://developers.notion.com/reference/post-database-query
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No personal information is collected.
Feedback