| ViewsEndpoint | R Documentation |
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.
A list containing the parsed API response.
queriesViews Queries Endpoint
new()Initialise views endpoint.
Not to be called directly, e.g., use notion$views instead.
ViewsEndpoint$new(client)
clientNotion Client instance
create()Create a view
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 )
data_source_idCharacter (required). The ID of the data source this view is scoped to.
nameCharacter (required). The name of the view.
typeCharacter (required). The type of view to create.
database_idCharacter. The ID of the database to create a view in.
Mutually exclusive with view_id and create_database
view_idCharacter. The ID of a dashboard view to add this view to
as a widget. Mutually exclusive with database_id and create_database.
filterNamed list (JSON object). Filter to apply to the view.
sortsList of lists (JSON array). Sorts to apply to the view.
quick_filtersNamed list (JSON object). Key-value pairs of quick filters to pin in the view's filter bar.
create_databaseNamed list (JSON object). Create a new linked database
block and add the view to it. Mutually exclusive with database_id and view_id
configurationNamed list (JSON object). View presentation configuration.
positionNamed 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).
placementNamed 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.
retrieve()Retrieve a view
ViewsEndpoint$retrieve(view_id)
view_idID of a Notion view.
update()Update a view
ViewsEndpoint$update( view_id, name = NULL, filter = NULL, sorts = NULL, quick_filters = NULL, configuration = NULL )
view_idID of a Notion view.
nameCharacter. New name for the view.
filterNamed list (JSON object). Filter to apply to the view.
sortsList of lists (JSON array). Property sorts to apply to the view.
quick_filtersNamed list (JSON object). Key-value pairs of quick filters to add/update.
configurationNamed list (JSON object). View presentation configuration.
delete()Delete a view
ViewsEndpoint$delete(view_id)
view_idID of a Notion view.
list()List all views in a database
ViewsEndpoint$list( database_id = NULL, data_source_id = NULL, start_cursor = NULL, page_size = NULL )
database_idCharacter. ID of a Notion database to list views for.
At least one of database_id or data_source_id is required.
data_source_idCharacter. 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_cursorCharacter. For pagination. If provided, returns results starting from this cursor. If NULL, returns the first page of results.
page_sizeInteger. Number of items to return per page (1-100). Defaults to 100
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.