Skip to content

Commit 29f7e25

Browse files
committed
Change example from using page API to using database API
1 parent f606649 commit 29f7e25

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ GitHub will create a new clone under your account, and then you can get started
2121
1. Make sure you've [created a Notion integration](https://developers.notion.com/docs/getting-started) and have a secret Notion token.
2222
2. Add your Notion token to a `.env` file at the root of this repository: `echo "NOTION_TOKEN=[your token here]" > .env`.
2323
3. Run `npm install`.
24-
4. Edit the `page_id` in `index.ts` from FIXME to be any page currently shared with your integration.
24+
4. Edit the `database_id` in `index.ts` from FIXME to be any database currently shared with your integration.
2525
5. Run `npm start` to run the script.
2626

2727
Now you can head over to our [developer documentation](https://developers.notion.com/) for more information on using the Notion API!

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "fixme-your-notion-app",
2+
"name": "notion-sdk-project",
33
"version": "1.0.0",
44
"description": "",
55
"main": "dist/index.js",

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ async function main() {
88
auth: process.env.NOTION_TOKEN,
99
});
1010

11-
const page = await notion.pages.retrieve({
12-
page_id: "FIXME",
11+
const response = await notion.databases.query({
12+
database_id: "FIXME",
1313
});
1414

15-
console.log("Got page:", page);
15+
console.log("Got response:", response);
1616
}
1717

1818
main()

0 commit comments

Comments
 (0)