内容
ページオブジェクト の中に
url
キーが用意され、Notion ページへの URL が返されるようになった。これはページオブジェクトとデータベースのクエリの結果に影響する。検証
いつものようにこのページを取得してみる。
#!/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":"URLが含まれる", "sort":{ "direction":"ascending", "timestamp":"last_edited_time" } }'
結果はこちら。かなり下の方だが、url キーが入っていて、ここにアクセスするとこのページが表示される。
{ "object": "list", "results": [ { "object": "page", "id": "01c7519c-ce93-4700-8266-6fd6970f1682", "created_time": "2021-11-10T01:33:00.000Z", "last_edited_time": "2021-11-10T01:38: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": "Page objects now contain url", "link": null }, "annotations": { "bold": false, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "default" }, "plain_text": "Page objects now contain url", "href": null } ] }, "URL": { "id": "o%3A~F", "type": "url", "url": "https://developers.notion.com/changelog/page-objects-now-return-url" }, "タグ": { "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": "ページオブジェクトにURLが含まれるようになった", "link": null }, "annotations": { "bold": false, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "default" }, "plain_text": "ページオブジェクトにURLが含まれるようになった", "href": null } ] } }, "url": "https://www.notion.so/URL-01c7519cce93470082666fd6970f1682" } ], "next_cursor": null, "has_more": false }
Notion API Changelog まとめ