Examples for Search-Endpoint

Search

// Returns all databases and pages of the workspace
\Notion::search()
        ->limit(5) // limit is optional
        ->query()
        ->asCollection();

// Returns all databases and pages of the workspace, sorted by last_edited_time of the database/page
\Notion::search()
        ->sortByLastEditedTime($direction) // $direction can be 'ascending' or 'descending' ('ascending' is default)
        ->query()
        ->asCollection();

// Returns all databases and pages of the workspace, filtered by the searchText you provide (the searchText is filtering based of the title of databases/pages)
\Notion::search($yourSearchText)
        ->query()
        ->asCollection();

// Returns all pages of the workspace
\Notion::search()
        ->onlyPages()
        ->query()
        ->asCollection();

// Returns all databases of the workspace
\Notion::search()
        ->onlyDatabases()
        ->query()
        ->asCollection();