| DataSourcesEndpoint | R Documentation |
Handle all data sources operations in the Notion API
Note: Access this endpoint through the client instance, e.g., notion$datas_ources. Not to be instantiated directly.
A list containing the parsed API response.
new()Initialise data sources endpoint.
Not to be called directly, e.g., use notion$datasources instead.
DataSourcesEndpoint$new(client)
clientNotion Client instance
create()Create a data source
DataSourcesEndpoint$create(parent, properties, title = NULL, icon = NULL)
parentNamed list (JSON object) (required). An object specifying the parent of the new data source to be created.
propertiesNamed list (JSON object) (required). Property schema of data source.
titleList of lists (JSON array). Title of data source.
iconNamed list (JSON object). Page icon.
retrieve()Retrieve a data source
DataSourcesEndpoint$retrieve(data_source_id)
data_source_idCharacter (required). ID of a Notion data source.
list_templates()List page templates available for a data source
DataSourcesEndpoint$list_templates( data_source_id, name = NULL, start_cursor = NULL, page_size = NULL )
data_source_idCharacter (required). ID of a Notion data source.
nameCharacter. Name to filter templates by.
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
update()Update a data source
DataSourcesEndpoint$update( data_source_id, title = NULL, icon = NULL, properties = NULL, in_trash = NULL, parent = NULL )
data_source_idCharacter (required). ID of a Notion data source.
titleList of lists (JSON array). Title of data source.
iconNamed list (JSON object). Page icon.'
propertiesNamed list (JSON object). Key-value pairs representing the data source's properties.
in_trashBoolean. Whether the database should be moved to or from the trash.
parentNamed list (JSON object). The parent of the data source, when moving it to a different database.
query()Query a data source
DataSourcesEndpoint$query( data_source_id, filter_properties = NULL, sorts = NULL, filter = NULL, start_cursor = NULL, page_size = NULL, in_trash = NULL, result_type = NULL )
data_source_idCharacter (required). ID of a Notion data source.
filter_propertiesCharacter vector. Page property value IDs to include in the response schema. If NULL (default), all properties are returned.
sortsList of lists (JSON array). Sort conditions to apply to the query
filterList of lists (JSON array). Filter conditions to apply. to the query
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
in_trashBoolean. If TRUE, trashed pages are included in the results alongside
non-trashed pages. If FALSE or NULL (default), only non-trashed pages are returned.
result_typeCharacter. Filter results by type. Available options are
"page" and "data_source". If NULL (default), all result types are returned.
notion <- notion_client()
# ----- Create a data source
notion$data_sources$create(
list(
database_id = "ffec20ee-1450-4da8-9904-f4babba0e9c0"
),
properties = list(
Title = list(
title = no_config()
)
),
title = list(list(
text = list(
content = "Test data source"
)
))
)
# ----- Update data source
notion$data_sources$update(
"34033ea0-c1e4-8112-bc3a-000bc940aa45",
properties = list(
Status = list(
status = list(
options = list(
list(
name = "To do",
color = "red"
),
list(
name = "Done",
color = "green"
)
)
)
)
)
)
# ----- Retrieve a data source
notion$data_sources$retrieve("34033ea0-c1e4-8112-bc3a-000bc940aa45")
# ----- List data source templates
notion$data_sources$list_templates("34033ea0-c1e4-8112-bc3a-000bc940aa45")
# ----- Query a data source
notion$data_sources$query(
"34033ea0-c1e4-8112-bc3a-000bc940aa45",
filter = list(
property = "Status",
status = list(
equals = "To do"
)
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.