Add NotionBlockToPage - fasteiner/Notion GitHub Wiki


Category: Commands external help file: Notion-help.xml Module Name: Notion online version: https://developers.notion.com/reference/patch-block-children schema: 2.0.0 Type: Command

Add-NotionBlockToPage

SYNOPSIS

Adds one or more Notion blocks to a specified Notion page.

SYNTAX

Page

Add-NotionBlockToPage -Page <notion_page> -Block <notion_block[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

PageID

Add-NotionBlockToPage -pageID <Object> -Block <notion_block[]> [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

The Add-NotionBlockToPage function allows adding Notion blocks to an existing Notion page. The function takes a notion_page object representing the parent page and one or more notion_block objects representing the content to be added. It then makes an API request to update the page with the new blocks.

EXAMPLES

EXAMPLE 1

$Page = Get-NotionPage -Id "12345678-90ab-cdef-1234-567890abcdef"
$Block = New-NotionBlock -Type "paragraph" -Text "Hello, Notion!"
Add-NotionBlockToPage -Page $Page -Block $Block

Description: This example retrieves a Notion page by ID and creates a new paragraph block, then adds it to the page.

EXAMPLE 2

$Page = Get-NotionPage -Id "12345678-90ab-cdef-1234-567890abcdef"
$Block1 = New-NotionBlock -Type "heading_1" -Text "Main Heading"
$Block2 = New-NotionBlock -Type "paragraph" -Text "This is a paragraph under the heading."
Add-NotionBlockToPage -Page $Page -Block @($Block1, $Block2)

Description: This example retrieves a Notion page and adds a heading block followed by a paragraph block to it.

PARAMETERS

-Block

Specifies the Notion block(s) to be added to the page. Type: notion_block[] Required: Yes Position: Named Accept pipeline input: No Help Message: The block to add to the page.

Type: notion_block[]
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Page

Specifies the parent Notion page to which the block(s) will be added. Type: notion_page Required: Yes Position: Named Accept pipeline input: No ParameterSetName: Page Help Message: The parent page to add the block to.

Type: notion_page
Parameter Sets: Page
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-pageID

Specifies the page id of the parent page. Type: string Required: Yes Position: Named Accept pipeline input: No ParameterSetName: PageID Help Message: The page id of the parent page.

Type: Object
Parameter Sets: PageID
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

The function returns the response from the Notion API after attempting to add

the blocks to the specified page.

NOTES

  • This function currently requires a notion_page object as input. Future updates may add support for specifying a Page ID directly.
  • The function converts the blocks into JSON before making an API request.

RELATED LINKS

https://developers.notion.com/reference/patch-block-children

⚠️ **GitHub.com Fallback** ⚠️