HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
執筆中ページ/
📕
「Notion API 活用術」テンプレート
/
3️⃣
S13. 個別取得 (Read)
3️⃣

S13. 個別取得 (Read)

以下の API アクセスで使用するあなたのインテグレーションキーはこちらです。元の場所から同期ブロックで参照しています。
📝
自分のインテグレーションキーを記録
コピーしたインテグレーションキー

13.1 bot ユーザの取得 (Retrieve your token’s bot user)

ここでは、Talend API Tester を使います。まだインストールしていない人は、
1️⃣
S5. Talend API Tester のインストール
でインストールしてください。
  • Bot ユーザを取得するスクリプトを dry_run で確認します。
    • print UserObject.find_me(dry_run: true)
  • 後で参照するために結果を記録しておきます。
    • 📝
      JSON 部分をコピー&貼り付け
      File object
  • bot user 取得の API の説明はこちらです。
    • Start building with the Notion API
      Retrieves the bot User associated with the API token provided in the authorization header. The bot will have an owner field with information about the person who authorized the integration. Integration capabilities This endpoint is accessible from by integrations with any level of capabilities.
      Start building with the Notion API
      https://developers.notion.com/reference/get-self
      Start building with the Notion API
  • Talend API Tester には以下のようにパラメータを設定します。
    • GET
      METHOD
      https://api.notion.com/v1/users/me
      SCHEME
      Notion-Version
      Notion-Version のキー
      2022-06-28
      Notion-Version の値
      Authorization
      Notion-Version のキー
      Bearer インテグレーションキーの内容
      Notion-Version の値
  • 全てを設定すると以下のようになります。Bearer の後ろのスペースを忘れないでください。最後に Send を押すと結果が返ってきます。
    • notion image
 

13.2 ユーザの取得 (Retrieve a user)

  • ユーザ取得 API の説明はこちらです。
    • Start building with the Notion API
      Retrieves a User using the ID specified. Integration capabilities This endpoint requires an integration to have user information capabilities. Attempting to call this API without user information capabilities will return an HTTP response with a 403 status code. For more information on integration capabilities, see the capabilities guide.
      Start building with the Notion API
      https://developers.notion.com/reference/get-user
      Start building with the Notion API
  • 2章で取得したユーザ ID がここに表示されています。
    • 📝
      自分の User Object の id を記録します。"id": "この部分をコピー"のような形式の部分があるので、該当部分をコピーして、以下の欄に貼り付けておいてください。
      例: 2200a911-6a96-44bb-bd38-6bfb1e01b9f6
      user_id
  • この user_id を SCHEME の me の部分に置き換えて、Send します。
    • https://api.notion.com/v1/users/ここに上のuser_idを記述
      SCHEME

13.3 ページの取得 (Retrieve a page)

  • ページ取得 API の説明はこちらです。
    • Start building with the Notion API
      Retrieves a Page object using the ID specified. Responses contains page properties, not page content. To fetch page content, use the retrieve block children endpoint. Each page property item is computed with a limit of 25 page references.
      Start building with the Notion API
      https://developers.notion.com/reference/retrieve-a-page
      Start building with the Notion API
  • このページの URL を取得してここに貼り付けてください。
    • 📝
      ページURL
      例: https://www.notion.so/hkob/S13-Read-dc45f0d4304b48749c292217a5ff9c12?pvs=4
  • この URL からこのページ ID を取り出して貼り付けておきましょう。
    • 📝
      page_id (上記ページ URL の末尾または ? の前の 32 桁の 16 進数)
      例: dc45f0d4304b48749c292217a5ff9c12
page_id を以下の URL の最後に書き込んで Send しましょう。
https://api.notion.com/v1/pages/ここに上のpage_idを記述
SCHEME

13.4 データベースの取得 (Retrieve a database)

  • データベース取得 API の説明はこちらです。
    • Start building with the Notion API
      Retrieves a Database object using the ID specified. Integration capabilities This endpoint is accessible from by integrations with any level of capabilities. The database object returned will adhere to the limitations of the integration's capabilities. For more information on integration capabilities, see the capabilities guide.
      Start building with the Notion API
      https://developers.notion.com/reference/retrieve-a-database
      Start building with the Notion API
  • 2章のサンプルデータベースをメンションしています。データベースのリンクを取得するには、リンク先を開いてから、Cmd-L や Ctrl-L で URL を取得してください。
    • サンプルデータベース
  • 取得したデータベース URL を貼り付けておきましょう。
    • 📝
      データベースURL
      例: https://www.notion.so/hkob/0e606e9397844e4aac29480f46dc8c82?v=53a6075ece724e3e9a5e5617e28009f6
  • この URL からこのデータベースの ID を取り出して貼り付けておきましょう。
    • 📝
      database_id 上の URL の / から ? までの間の 32 桁の 16 進数)
      例: 0e606e9397844e4aac29480f46dc8c82
  • ヘッダ部分は Page object の場合から変更がないので、SCHEME の部分だけ修正すればよいです。
    • https://api.notion.com/v1/databases/ここに上のdatabase_idを記述
      SCHEME

13.5 ブロックの取得 (Retrieve a block)

  • ブロック取得 API の説明はこちらです。
    • Start building with the Notion API
      Retrieves a Block object using the ID specified. If a block contains the key has_children: true, use the Retrieve block children endpoint to get the list of children Integration capabilities This endpoint requires an integration to have read content capabilities. Attempting to call this API without read content capabilities will return an HTTP response with a 403 status code.
      Start building with the Notion API
      https://developers.notion.com/reference/retrieve-a-block
      Start building with the Notion API
  • 取得したブロック URL を貼り付けておきましょう。
    • 📝
      ブロックURL
      例: https://www.notion.so/hkob/S13-Read-dc45f0d4304b48749c292217a5ff9c12?pvs=4#6aa02b918bde45f686b86129a6f012a2
この URL からこのブロックの ID を取り出して貼り付けておきましょう。
📝
block_id (#より後ろの部分)
例: 6aa02b918bde45f686b86129a6f012a2
ヘッダ部分は Page object の場合から変更がないので、SCHEME の部分だけ修正すればよいです。
https://api.notion.com/v1/blocks/ここに上のblock_idを記述
SCHEME

13.6 プロパティの取得 (Retrieve a page property item)

上で取得したページ ID がここに表示されています。
📝
page_id (上記ページ URL の末尾または ? の前の 32 桁の 16 進数)
例: dc45f0d4304b48749c292217a5ff9c12
ヘッダ部分は Page object の場合から変更がないので、SCHEME の部分だけ修正すればよいです。
https://api.notion.com/v1/pages/ここに上のpage_idを記述/properties/title
SCHEME

🔹
この CHAPTER 内の SECTION
🔶
CHAPTER LIST