v2 SDK does not return page properties
See original GitHub issueReport bugs here only for the Node JavaScript library.
If you’re having problems using Notion’s API, or have any other feedback about the API including feature requests for the JavaScript library, please email support at developers@makenotion.com.
Describe the bug When I query a page using the v2.0.0 SDK and above, the responses do not include property values. Just an ID. There’s no indication in the documentation that an extra step is required to fetch the page property values.
I’m trying to paginate through a database, but each row contains no property values. It also happens retrieving a single page. I’ll write a minimal example:
To Reproduce Node version: 16.14.0 Notion JS library version: 1.0.4
spec.js:
const { Client } = require('@notionhq/client')
const notion = new Client({ auth: process.env.NOTION_TOKEN })
const page_id = process.env.NOTION_PAGE_ID
notion.pages.retrieve({ page_id }).then((page) => {
console.log(page.properties)
})
Result (SDK v1.0.4):
{
Case: { id: '%3BVfS', type: 'files', files: [] },
Guitar: { id: '%3DkPp', type: 'files', files: [ [Object] ] },
'Made In': { id: 'O%7BaE', type: 'rich_text', rich_text: [ [Object] ] },
State: { id: 'PQJs', type: 'rich_text', rich_text: [] },
Serial: { id: 'WuDR', type: 'rich_text', rich_text: [ [Object] ] },
Tags: { id: 'ii%5E%7C', type: 'multi_select', multi_select: [ [Object] ] },
Name: { id: 'title', type: 'title', title: [ [Object] ] }
}
Result (v2.0.0):
{
Case: { id: '%3BVfS' },
Guitar: { id: '%3DkPp' },
'Made In': { id: 'O%7BaE' },
State: { id: 'PQJs' },
Serial: { id: 'WuDR' },
Tags: { id: 'ii%5E%7C' },
Name: { id: 'title' }
}
Steps to reproduce the behavior: Run the above script and compare v1.0.4 to 2.0.0 output.
Expected behavior The SDK should include Notion properties on simple queries.
If this is intentional behaviour: The documentation should make this very obvious! How do I retrieve a full database in the v2 SDK?
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:8
Top GitHub Comments
Just to add a data point, moving from API v2022-02-22 to v2022-06-28 makes me go from 2 requests (querying a db with 108 elements to get 12 properties) to 12*108 requests, so about 1300 requests total.
Having a method to get all properties of a page would be more reasonable… I would do one request per db object.
Aha. This is apparently intended behaviour! I have found a note halfway down the “page” documentation:
If anyone else gets stuck with this, it looks like this is the way the API is designed. Github issues are probably the wrong forum for feedback about the design changes, but this is an eyebrow-raising decision if ever I’ve seen one.
Updated issue for the Notion team:
properties
field will include the property value.I’m downgrading to the v1 SDK so I don’t have to write as much code. I guess if I want to use V2 I have to write a bunch of code to send 1 round-trip per database cell?