3

When I am trying to append children block, the block id is required.
I tried to find in documentation but didn't get it.
How can I get that block id?

kevin liu
  • 33
  • 1
  • 3

2 Answers2

9

The official documentation says:

A block object represents content within Notion. Blocks can be text, lists, media, and more. A page is a type of block, too!

Some blocks have more content nested inside them. Some examples are indented paragraphs, lists, and toggles. The nested content is called children, and children are blocks, too! Block types which support children are "paragraph", "bulleted_list_item", "numbered_list_item", "toggle", "to_do" and "page".

To get the id of a page, simply open the page in notion and check the URL. The URLs for pages usually have the format:

https://www.notion.so/Creating-Page-Sample-ee18b8779ae54f358b09221d6665ee15

ee18b8779ae54f358b09221d6665ee15 is the page's id, which you can use as the block id.

To get the id for other types of blocks (paragraph", "bulleted_list_item", "numbered_list_item", "toggle", "to_do"), simply click on the menu icon for the block and click "Copy link". enter image description here

Afterwards, paste the link in the browser and it should look like this:

https://www.notion.so/Creating-Page-Sample-ee18b8779ae54f358b09221d6665ee15#7fcb3940a1264aadb2ad4ee9ffe11b0e

7fcb3940a1264aadb2ad4ee9ffe11b0e is the block id which you can use in the request.

Dharman
  • 30,962
  • 25
  • 85
  • 135
3

There is an example in the official documentation where they say

The block_id parameter is the ID of any existing block. If you're following from the example above, the response contained a page ID. Let's use that page ID to read the sample content from the page. We'll use "16d8004e-5f6a-42a6-9811-51c22ddada12" as the block ID.

Hence, I would use the PageID as BlockID ot the Append Block Children method.

nilleb
  • 967
  • 6
  • 28
  • 2
    I was confused by the API first. My initial thought was - I retrieve a page -> get blocks ids -> use these ids to fetch the content. But it appeared to be much easier. I just retrieved block children, where block as you mentioned is just a page id. – Dmitriy Jul 17 '21 at 00:10