8000 Add support for Column List and Column Block · Issue #190 · notion-dotnet/notion-sdk-net · GitHub
[go: up one dir, main page]

Skip to content
Add support for Column List and Column Block #190
Closed
@KoditkarVedant

Description

@KoditkarVedant

Notion has added support for column_list and column block types.

You can now add Column Lists and Columns to pages and other block types.

  • Column Lists are parent blocks for column children. They can only contain children of type column.
  • Columns are parent blocks for any supported block children, excluding columns. They can only be appended to column_lists.

When initially creating a column_list block via Append block children, the column list must have at least 2 columns, and those columns must have at least one child each.

When fetching content for a column_list, first fetch the the column children via Retrieve block children. Then fetch the children for each column block.

Below is an example request body for appending column_list and nested column children.

{
  "children": [
    {
      "object": "block",
      "type": "column_list",
      "column_list": {
        "children": [
          {
            "object": "block",
            "type": "column",
            "column": {
              "children": [
                {
                  "object": "block",
                  "type": "paragraph",
                  "paragraph": {
                    "text": [
                      {
                        "type": "text",
                        "text": {
                          "content": "some text here"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          },
          {
            "object": "block",
            "type": "column",
            "column": {
              "children": [
                {
                  "object": "block",
                  "type": "paragraph",
                  "paragraph": {
                    "text": [
                      {
                        "type": "text",
                        "text": {
                          "content": "some text here"
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        ]
      }
    }
  ]
}

Below is an example response of appending column_list children.

{
    "object": "list",
    "results": [
        {
            "object": "block",
            "id": "ca042aa7-2e23-4541-8059-abff360d6752",
            "created_time": "2021-10-25T17:00:00.000Z",
            "last_edited_time": "2021-10-25T17:00:00.000Z",
            "has_children": true,
            "archived": false,
            "type": "column_list",
            "column_list": {}
        }
    ],
    "next_cursor": null,
    "has_more": false
}

Below is an example request body for appending column children. Note that the parent that is being added to must be a block of type column_list.

{
    "children": [
        {
            "object": "block",
            "type": "column",
            "column": {
                "children": [
                    {
                        "object": "block",
                        "type": "paragraph",
                        "paragraph": {
                            "text": [
                                {
                                    "type": "text",
                                    "text": {
                                        "content": "some text here"
                                    }
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

Below is an example response of appending column children.

{
    "object": "list",
    "results": [
        {
            "object": "block",
            "id": "f40c3a13-30d1-4594-bd6f-cdbc15b2c006",
            "created_time": "2021-10-25T21:25:00.000Z",
            "last_edited_time": "2021-10-25T21:25:00.000Z",
            "has_children": true,
            "archived": false,
            "type": "column",
            "column": {}
        }
    ],
    "next_cursor": null,
    "has_more": false
}

Notion Api changelog: https://developers.notion.com/changelog/column-list-and-column-support

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0