約半年ぶりの後方互換性のない新バージョンです(2021-8-16 → 2022-02-22)。日付的に覚えやすいバージョンですね。データベースの検索用のプロパティ名とオブジェクトのプロパティ名を揃えたところが大きいです。かなり分かりやすくなりました。
概要説明
我々は互換性のない変更のみをバージョン分けしているため、一般的にはアップグレードしなくても新機能にはアクセスすることが可能です。リクエストごとにバージョンヘッダを付け替えできるので、段階的にアップグレードして、最新版に到達することができます。
我々は以下のような後方互換性のない変更を加えた Notion-Version
2022-02-22
をリリースします。- ブロック内の
text
はrich_text
に名称変更されました。これはデータベースのプロパティタイプと一致させるためです。
- クエリデータベースのフィルタの変更
-
phone_number
とrich_text
プロパティによってフィルタリングされる際、phone
とtext
はサポートされなくなりました。代わりに、phone_number
とrich_text
を使ってください。 rollup
クエリデータベースフィルタはtext
キーワードを受け入れなくなりました。代わりにrich_text
を使ってください。formula
クエリデータベースはtext
キーワードを受け入れなくなりました。代わりにstring
を使ってください。
property_item
オブジェクトはtype
,next_url
, とid
を返すようになりました。
- List Databases API エンドポイントは非推奨になりました。
コンテントブロック内の text
プロパティは rich_text
に変更されました。
データベースプロパティタイプとの一貫性を保つために、
text
プロパティは rich_text
に変更しました。これは以下、ブロックタイプに影響します。→ paragraph
, heading_1
, heading_2
, heading_3
, callout
, quote
, bulleted_list_item
, numbered_list_item
, to_do
,toggle
, code
,template
.これは以前の
text
プロパティです。{ "type": "paragraph", //...other keys excluded "paragraph": { "text": [{ "type": "text", "text": { "content": "Lacinato kale", "link": null } }] } }
これは更新された
rich_text
プロパティです。{ "type": "paragraph", //...other keys excluded "paragraph": { "rich_text": [{ "type": "text", "text": { "content": "Lacinato kale", "link": null } }] } }
データベースクエリフィルタの変更
phone
and text
no longer supported
Version 2022-02-22 では、クエリデータベースエンドポイントでの、
phone
と text
プロパティフィルタをサポートしなくなりました。データベースのプロパティタイプとの一貫性を保つために、代わりに phone_number
と rich_text
プロパティを使用します。より具体的に、このデータベースクエリは検証エラーを投げるようになります。
{ "filter": { "and": [ { "property": "Phone number", "phone": { "equals": "1112223333" } } ] } }
このデータベースクエリは成功します。
{ "filter": { "and": [ { "property": "Phone number", "phone_number": { "equals": "1112223333" } } ] } }
rollup
プロパティは text
の代わりに rich_text
を受け付けます。
ロールアッププロパティは
text
の変わりに rich_text
キーワードで構成する必要があります。具体的に、ロールアッププロパティが以下のような形でレンダリングされているとします。"rollup property": { "id": "~%5Bw%5C", "type": "rollup", "rollup": { "type": "array", "array": [ { "type": "rich_text", "rich_text": [ { "type": "text", "text": { "content": "update text 2", "link": null }, "annotations": { "bold": true, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "red" }, "plain_text": "update text 2", "href": null } ] }, { "type": "rich_text", "rich_text": [ { "type": "text", "text": { "content": "another text", "link": null }, "annotations": { "bold": false, "italic": false, "strikethrough": false, "underline": false, "code": false, "color": "default" }, "plain_text": "another text", "href": null } ] } ], "function": "show_original" } }
このフィルタは version 2022-02-22 では機能しなくなります。
{ "filter": { "property": "rollup property", "rollup": { "any": { "text": { "contains": "update text" } } } } }
代わりに、以下のように記述します。
{ "filter": { "property": "rollup property", "rollup": { "any": { "rich_text": { "contains": "update text" } } } } }
formula
property filters accept string
instead of text
フォーミュラプロパティフィルタは、
text
キーワードではなく string
キーワードを使用して構築する必要があります。具体的には、ページの数式プロパティが以下のように構築されているとします。"formula property": { "id": "m%5D%3F%5C", "type": "formula", "formula": { "type": "string", "string": "update text 2,another text" } }
このフィルタは Version 2022-02-22 では機能しなくなります。
{ "filter": { "property": "formula property", "formula": { "text": { "contains": "update text" } } } }
代わりに以下のように記述してください。
{ "filter": { "property": "formula property", "formula": { "string": { "contains": "update text" } } } }
プロパティリストアイテムは型を持つようになりました
プロパティリストアイテムの型は、
property_item
になりました。 ロールアップ集計は、その型の中に記載されるようになりました。さらに id
フィールドと next_url
フィールドが追加され、次のフェッチができるようになります。これは以前の
rollup
property_item
のリストです。{ "object": "list", "results": [ { "object": "property_item", "type": "relation", "relation": { "id": "83f92c9d-523d-466e-8c1f-9bc2c25a99fe" } }, ... ], "next_cursor": "some-next-cursor-value", "has_more": true, "rollup": { "type": "date", "date": { "start": "2021-10-07T14:42:00.000+00:00", "end": null }, "function": "latest_date" }, "type": "rollup" }
こちらは新しい
rollup
property_item
です。{ "object": "list", "results": [ { "object": "property_item", "id": "xYz890", "type": "relation", "relation": { "id": "83f92c9d-523d-466e-8c1f-9bc2c25a99fe" } }, ... ], "next_cursor": "some-next-cursor-value", "has_more": true, "type": "property_item", "property_item": { "id": "aBcD123" "next_url": "https://api.notion.com/v1/pages/b55c9c91-384d-452b-81db-d1ef79372b75/properties/aBcD123?start_cursor=some-next-cursor-value", "type": "rollup", "rollup": { "type": "date", "date": { "start": "2021-10-07T14:42:00.000+00:00", "end": null }, "function": "latest_date" } }, }
リストデータベースエンドポイントは非推奨になりました
全ての Databases の一覧を取得するリストエンドポイントはこのバージョンから削除されます。この機能の代わりに、 Search API を利用することができます。リストデータベースエンドポイントは明示的に共有されたページのみを検索しますが、検索エンドポイントは共有されたページ内の子ページも返します。