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

S17. 削除 (Delete)

17.1 ページをアーカイブ (Archive (delete) a page)

  • ページのアーカイブは Update a page で archived キーを true に変更する処理に相当します。説明はこちらに記述されています。
    • Start building with the Notion API
      Updates page property values for the specified page. Properties that are not set via the properties parameter will remain unchanged. If the parent is a database, the new property values in the properties parameter must conform to the parent database's property schema. Archive (delete) a page Set the...
      Start building with the Notion API
      https://developers.notion.com/reference/patch-page
      Start building with the Notion API
削除するページ
  • 今回削除するページを上に設置しました。このページの URL を取得してここに貼り付けてください。
    • 📝
      ページURL
      例: https://www.notion.so/hkob/bd21c752369b440f961d0fa5511a81a8?pvs=4
  • page_id は末尾?の前の 32 桁の 16 進数です。下の赤字の部分にこの page_id を記述してください。メソッドは PATCH にしてください。
    • https://api.notion.com/v1/pages/ここに上のpage_idを記述
      SCHEME
  • BODY は以下のようになります。
    • { "archived": true }
 
  • 設定画面は以下のようになります。METHOD は前の続きで PATCH のままです。
    • notion image
  • archived キー値を false にして再度実行するとページを復元することができます。ただし、復元したページはページの最下部になります。
    • { "archived": true }

17.2 ブロックを削除 (Delete a block)

  • ブロックを削除する API の説明はこちらです。
    • Start building with the Notion API
      Sets a Block object, including page blocks, to archived: true using the ID specified. Note: in the Notion UI application, this moves the block to the "Trash" where it can still be accessed and restored. To restore the block with the API, use the Update a block or Update page respectively.
      Start building with the Notion API
      https://developers.notion.com/reference/delete-a-block
      Start building with the Notion API
削除するブロック
  • 今回削除するブロックを上に設置しました。このブロックの URL を取得してここに貼り付けてください。
    • 📝
      ブロックURL
      例: https://www.notion.so/hkob/T17-Delete-1c2e64542efe4207b161f7835f9162f3?pvs=4#ac2fee85b83e401a8ad2ba0beb3179fd
      https://www.notion.so/hkob/S17-Delete-1c2e64542efe4207b161f7835f9162f3?pvs=4#ac2fee85b83e401a8ad2ba0beb3179fd
  • block_id は末尾の # の後ろの 32 桁の 16 進数です。下の赤字の部分にこの block_id を記述してください。メソッドは DELETE に変更してください。DELETE にするとヘッダは自動的に Notion-Version と Authorization の二つだけになります。また BODY もなくなります。
    • https://api.notion.com/v1/blocks/ここに上のblock_idを記述
      SCHEME
  • 設定画面は以下のようになります。
    • notion image
  • 削除したページは archived キー値を false に戻すことで復元することができます。メソッドを PATCH に設定し、BODY を以下のように記述します。この場合も復元されるのはページの最下部になります。
    • { "archived": false }
  • 設定画面は以下のようになります。
    • notion image

🔹
この CHAPTER 内の SECTION
S12. API アクセスの種類
12
S13. 個別取得 (Read)
13
S14. 一覧取得 (Read)
14
S15. 更新 (Update)
15
S16. 作成 (Create)
16
S17. 削除 (Delete)
17
🔶
CHAPTER LIST
C1. Notion APIの概要と利用準備
1
C2. Notion APIで理解するNotionのデータ構造
2
C3. Notion APIの基本(CRUD別の紹介)
3
C4. Google Apps Scriptによる応用
4
C5. ショートカットによる応用
5
C6. NotionRubyMappingを利用したツール
6