Skip to content

How to read database, page and blocks - examples? #156

Answered by mariosimao
thysroes asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @thysroes, thanks for using the SDK!

Status filter

Regarding the status filter, I will update it to make it easier to understand.

To address the Status=Published filter, you could try the following:

<?php

use Notion\Notion;
use Notion\Databases\Query;
use Notion\Databases\Query\StatusFilter;

$token = $_ENV["NOTION_SECRET"];
$notion = Notion::create($token);

$databaseId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2";
$database = $notion->databases()->find($databaseId);

$query = Query::create()->changeFilter(
    StatusFilter::property("Status")->equals("Published"),
);

$result = $notion->databases()->query($database, $query);

$pages = $result->pages; // filtered pages

QueryAllPages error

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
4 replies
@thysroes
Comment options

@mariosimao
Comment options

@mariosimao
Comment options

@thysroes
Comment options

Answer selected by mariosimao
Comment options

You must be logged in to vote
4 replies
@mariosimao
Comment options

@thysroes
Comment options

@mariosimao
Comment options

@thysroes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working documentation Improvements or additions to documentation question Further information is requested
2 participants