Database-Endpoint Examples with Pagination
Query Database (with more than 100 entries)
# query the database (1 - 100 entries)
$response = \Notion::database("8284f3ff77e24d4a939d19459e4d6bdc")
->query();
# retreive items of database as Collection
$pageCollection = $response->asCollection();
# retreive items of database as Json (recommended for frontend-handling)
$pageJson = $response->asJson();
## -- PAGINATION --
# get next_cursor (uuid of first page, of next pagination-page)
$nextPageUuid = $response->getRawNextCursor();
# get StartCursor::class object, which can be used to get next page of pagination
$startCursor = $response->getNextCursor();
# get next iteration of pagination, with $startCursor (101 - 200 entries)
$responseWithOffset = Notion::database('8284f3ff77e24d4a939d19459e4d6bdc')
->offset($startCursor)
->query();
# as a quick alternative, you can use your previous response to query the next iteration of the pagination (101 - 200 entries)
$responseWithOffset = Notion::database('8284f3ff77e24d4a939d19459e4d6bdc')
->offsetByResponse($response)
->query();