ViewsEndpoint: R6 Class for Views Endpoint

ViewsEndpointR Documentation

R6 Class for Views Endpoint

Description

Handle all views operations in the Notion API

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

Value

A list containing the parsed API response.

Public fields

queries

Views Queries Endpoint

Methods

Public methods


Method new()

Initialise views endpoint. Not to be called directly, e.g., use notion$views instead.

Usage
ViewsEndpoint$new(client)
Arguments
client

Notion Client instance


Method create()

Create a view

Usage
ViewsEndpoint$create(
  data_source_id,
  name,
  type,
  database_id = NULL,
  view_id = NULL,
  filter = NULL,
  sorts = NULL,
  quick_filters = NULL,
  create_database = NULL,
  configuration = NULL,
  position = NULL,
  placement = NULL
)
Arguments
data_source_id

Character (required). The ID of the data source this view is scoped to.

name

Character (required). The name of the view.

type

Character (required). The type of view to create.

database_id

Character. The ID of the database to create a view in. Mutually exclusive with view_id and create_database

view_id

Character. The ID of a dashboard view to add this view to as a widget. Mutually exclusive with database_id and create_database.

filter

Named list (JSON object). Filter to apply to the view.

sorts

List of lists (JSON array). Sorts to apply to the view.

quick_filters

Named list (JSON object). Key-value pairs of quick filters to pin in the view's filter bar.

create_database

Named list (JSON object). Create a new linked database block and add the view to it. Mutually exclusive with database_id and view_id

configuration

Named list (JSON object). View presentation configuration.

position

Named list (JSON object). Where to place the new view in the database's view tab bar. Only applicable when database_id is provided. Defaults to "end" (append).

placement

Named list (JSON object). Where to place the new widget in a dashboard view. Only applicable when view_id is provided. Defaults to creating a new row at the end.

Details

Endpoint documentation


Method retrieve()

Retrieve a view

Usage
ViewsEndpoint$retrieve(view_id)
Arguments
view_id

ID of a Notion view.

Details

Endpoint documentation


Method update()

Update a view

Usage
ViewsEndpoint$update(
  view_id,
  name = NULL,
  filter = NULL,
  sorts = NULL,
  quick_filters = NULL,
  configuration = NULL
)
Arguments
view_id

ID of a Notion view.

name

Character. New name for the view.

filter

Named list (JSON object). Filter to apply to the view.

sorts

List of lists (JSON array). Property sorts to apply to the view.

quick_filters

Named list (JSON object). Key-value pairs of quick filters to add/update.

configuration

Named list (JSON object). View presentation configuration.

Details

Endpoint documentation


Method delete()

Delete a view

Usage
ViewsEndpoint$delete(view_id)
Arguments
view_id

ID of a Notion view.

Details

Endpoint documentation


Method list()

List all views in a database

Usage
ViewsEndpoint$list(
  database_id = NULL,
  data_source_id = NULL,
  start_cursor = NULL,
  page_size = NULL
)
Arguments
database_id

Character. ID of a Notion database to list views for. At least one of database_id or data_source_id is required.

data_source_id

Character. ID of a data source to list all views for, including linked views across the workspace. At least one of database_id or data_source_id is required.

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

Examples


notion <- notion_client()

# ----- Create a view
notion$views$create(
  "34033ea0-c1e4-8112-bc3a-000bc940aa45",
  "Test view",
  "table",
  "ffec20ee-1450-4da8-9904-f4babba0e9c0"
)


# ----- Retrieve a view
notion$views$retrieve("34033ea0-c1e4-8192-ac14-000cdad096ce")


# ----- List views
notion$views$list(data_source_id = "34033ea0-c1e4-8112-bc3a-000bc940aa45")


# ----- Update a view
notion$views$update("34033ea0-c1e4-8192-ac14-000cdad096ce", "Updated view name")


# ----- Delete a view
notion$views$delete("34033ea0-c1e4-8192-ac14-000cdad096ce")



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