Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] how can I query all databases using notion-sdk-js? #540

Open
liaodalin19903 opened this issue Jan 29, 2025 · 1 comment
Open

Comments

@liaodalin19903
Copy link

Excuse me,
how can I query all databases using notion-sdk-js?

It seems that according to the reference instructions on my side, I can only query the database with a specified database_id.

@Marcel-TO
Copy link

Marcel-TO commented Feb 21, 2025

If my understanding of the Notion-SDK is correct, then you can use the search function, since databases.list is deprecated.

Take for example the SearchBodyParameters:

type SearchBodyParameters = {
  sort?: {
    timestamp: "last_edited_time"
    direction: "ascending" | "descending"
  }
  query?: string
  start_cursor?: string
  page_size?: number
  filter?: { property: "object"; value: "page" | "database" }
}

When using search on your page (where you have the databases) and add the filter option for "database", then you should get a list of all databases. This includes the ID of each database, if you decide to query the items of each database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants