最近、Notion で最終更新者の情報が表示されるように変更されました。それに関するデータ構造の変更が紹介されています。詳細な例が示されているので、今回は検証はスキップします。

概要説明

ブロックページ、そしてデータベース の各オブジェクトについて、誰が新規作成、最終更新したかという情報を created_bylast_edited_by プロパティに追加しました。どちらのプロパティも objectid をキーに持つ ユーザオブジェクトです。これは、下位互換性のある変更であり、古いバージョンの API でも動作します。

(訳注: オリジナルはタブで切り替えられるようになっていますが、Notion ではまだ実装されていないため、ブロック、ページ、データベースのそれぞれのサンプルを並べて表示します)

ページオブジェクトの例

{
  "object": "page",
  "id": "e722caec-ae02-4a41-9bbd-286f65f8dca4",
  "created_time": "2022-02-15T21:24:00.000Z",
  "last_edited_time": "2022-02-17T22:40:00.000Z",
  "created_by": {
    "object": "user",
    "id": "71e95936-2737-4e11-b03d-f174f6f13087"
  },
  "last_edited_by": {
    "object": "user",
    "id": "5ba97cc9-e5e0-4363-b33a-1d80a635577f"
  },
  "cover": null,
  "icon": null,
  "parent": {
    "type": "page_id",
    "page_id": "a7e32210-c151-4b96-8b94-ea659b1e8e4f"
  },
  "archived": false,
  "properties": {
    "title": {
      "id": "title",
      "type": "title",
      "title": [
        {
          "type": "text",
          "text": {
            "content": "Tasks",
            "link": null
          },
          "annotations": {
            "bold": false,
            "italic": false,
            "strikethrough": false,
            "underline": false,
            "code": false,
            "color": "default"
          },
          "plain_text": "Tasks",
          "href": null
        }
      ]
    }
  },
  "url": "<https://notion.so/Tasks-e722caecae024a419bbd286f65f8dca4>"
}

ブロックオブジェクトの例

{
  "object": "block",
  "id": "9bc30ad4-9373-46a5-84ab-0a7845ee52e6",
  "created_time": "2021-03-16T16:31:00.000Z",
  "created_by": {
    "object": "user",
    "id": "cb38e95d-00cf-4e7e-adce-974f4a44a547"
    },
  "last_edited_time": "2021-03-16T16:32:00.000Z",
  "last_edited_by": {
    "object": "user",
    "id": "e79a0b74-3aba-4149-9f74-0bb5791a6ee6"    
    },
  "has_children": false,
  "type": "to_do",
  "archived": false,
  "to_do": {
    "rich_text": [
      {
        "type": "text",
        "text": {
          "content": "Lacinato kale",
          "link": null
        },
        "annotations": {
          "bold": false,
          "italic": false,
          "strikethrough": false,
          "underline": false,
          "code": false,
          "color": "default"
        },
        "plain_text": "Lacinato kale",
        "href": null
      }
    ],
    "checked": false
  }
}

データベースオブジェクトの例

{
  "object": "database",
  "id": "e8d49c2d-9644-4ba2-8511-918a62309665",
  "cover": null,
  "icon": null,
  "created_time": "2022-02-15T21:09:00.000Z",
  "created_by": {
    "object": "user",
    "id": "71e95936-2737-4e11-b03d-f174f6f13087"
  },
  "last_edited_by": {
    "object": "user",
    "id": "5ba97cc9-e5e0-4363-b33a-1d80a635577f"
  },
  "last_edited_time": "2022-02-17T18:43:00.000Z",
  "title": [
    {
      "type": "text",
      "text": {
        "content": "Tasks",
        "link": null
      },
      "annotations": {
        "bold": false,
        "italic": false,
        "strikethrough": false,
        "underline": false,
        "code": false,
        "color": "default"
      },
      "plain_text": "Tasks",
      "href": null
    }
  ],
  "properties": {
    "Tags": {
      "id": "keGJ",
      "name": "Tags",
      "type": "multi_select",
      "multi_select": {
        "options": []
      }
    },
    "Name": {
      "id": "title",
      "name": "Name",
      "type": "title",
      "title": {}
    }
  },
  "parent": {
    "type": "page_id",
    "page_id": "e722caec-ae02-4a41-9bbd-286f65f8dca4"
  },
  "url": "<https://notion.so/e8d49c2d96444ba28511918a62309665>",
  "archived": false
}

さらに データベースオブジェクト の場合には、それが削除されたかどうかを示すフラグである

archived プロパティを追加しました。 archived プロパティを データベースの更新を使って更新することで、データベースおよびその子孫のデータをアーカイブ、またはアーカイブ解除することが可能になります。


Notion API Changelog まとめ