BlocksChildrenEndpoint: R6 Class for Blocks children endpoint

BlocksChildrenEndpointR Documentation

R6 Class for Blocks children endpoint

Description

Handle all block children operations in the Notion API

Note: Access this endpoint through the client instance, e.g., notion$blocks$children. Not to be instantiated directly.

Value

A list containing the parsed API response.

Methods

Public methods


Method new()

Initialise block children endpoint. Not to be called directly, e.g., use notion$pages$children instead.

Usage
BlocksChildrenEndpoint$new(client)
Arguments
client

Notion Client instance


Method list()

Retrieve a block's children

Usage
BlocksChildrenEndpoint$list(block_id, start_cursor = NULL, page_size = NULL)
Arguments
block_id

String (required). The ID for a Notion block.

start_cursor

Character. For pagination. If provided, returns results starting from this cursor. If NULL, returns the first page of results.

page_size

Integer. Number of items to return per page (1-100). Defaults to 100.

Details

Endpoint documentation


Method append()

Append block children

Usage
BlocksChildrenEndpoint$append(block_id, children, position = NULL)
Arguments
block_id

String (required). The ID for a Notion block.

children

List of lists (JSON array) (required). Block objects to append as children to the block.

position

Named list (JSON object). Controls where new blocks are inserted among parent's children. Defaults to end of parent block's children when omitted.

Details

Endpoint documentation

Examples


notion <- notion_client()

# ----- Append children to a block
notion$blocks$children$append(
  "34033ea0-c1e4-81c4-afa0-d1ec98de4bec",
  list(
    list(
      object = "block",
      heading_2 = list(
        rich_text = list(list(
          text = list(content = "Test Heading")
        ))
      )
    )
  ),
  position = list(type = "start")
)


# ----- Retrieve children of a block
notion$blocks$children$list("34033ea0-c1e4-81c4-afa0-d1ec98de4bec")

# ----- Iterate through paginated results
## Not run: 
start_cursor <- NULL
has_more <- FALSE
resps <- list()
i <- 1

while (has_more) {
  resps[[i]] <- notion$blocks$children$list(
    "2926b407e3c44b49a1830609abe6744f",
    start_cursor
  )
  has_more <- resps[[i]][["has_more"]]
  start_cursor <- resps[[i]][["next_cursor"]]
  i <- i + 1
}

## End(Not run)


notionapi documentation built on April 13, 2026, 9:07 a.m.