データベースオブジェクトが 親プロパティを持つようになった。親ページの ID が parent という属性に入るので、そこからさらに参照することが可能となる。
試しにこのページ自体を取得して確認してみる。
#!/bin/sh
curl -X POST '<https://api.notion.com/v1/search>' \\
-H 'Authorization: Bearer '"$NOTION_API_KEY"'' \\
-H 'Content-Type: application/json' \\
-H "Notion-Version: 2021-08-16" \\
--data '{
"query":"親プロパティ",
"sort":{
"direction":"ascending",
"timestamp":"last_edited_time"
}
}'
結果はこんな感じ。parent という属性をみると、type が "database_id" となっており親がデータベースオブジェクトであることがわかる。そして、database_id にはそのデータベースの ID が記録されている。
{
"object": "list",
"results": [
{
"object": "page",
"id": "069987ff-6083-4920-9613-9f464765f11c",
"created_time": "2021-11-10T00:00:00.000Z",
"last_edited_time": "2021-11-10T00:09:00.000Z",
"cover": null,
"icon": null,
"parent": {
"type": "database_id",
"database_id": "c63c00ad-201d-4bed-82b0-18dfca9b6ba0"
},
"archived": false,
"properties": {
"日付": {
"id": "%3CWbe",
"type": "date",
"date": {
"start": "2021-07-13",
"end": null
}
},
"原題": {
"id": "%3FMR%7D",
"type": "rich_text",
"rich_text": [
{
"type": "text",
"text": {
"content": "Database objects now return parent",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "Database objects now return parent",
"href": null
}
]
},
"URL": {
"id": "o%3A~F",
"type": "url",
"url": "<https://developers.notion.com/changelog/database-objects-now-return-parent>"
},
"タグ": {
"id": "tUJV",
"type": "multi_select",
"multi_select": [
{
"id": "05f3b6b1-b6f1-49a2-bbdb-955cfb4d36f4",
"name": "IMPROVED",
"color": "gray"
}
]
},
"名前": {
"id": "title",
"type": "title",
"title": [
{
"type": "text",
"text": {
"content": "データベースオブジェクトが親プロパティを返すようになった",
"link": null
},
"annotations": {
"bold": false,
"italic": false,
"strikethrough": false,
"underline": false,
"code": false,
"color": "default"
},
"plain_text": "データベースオブジェクトが親プロパティを返すようになった",
"href": null
}
]
}
},
"url": "<https://www.notion.so/069987ff6083492096139f464765f11c>"
}
],
"next_cursor": null,
"has_more": false
}