tonigiri
tonigiri

Reputation: 177

Querying Notion database using API returns results that don't match the actual Database values

I am making successful calls to query a Notion Database, but the data that I am getting from the API call is just not consistent with the actual data from Notion.

I've been pulling my hair out, as I can't figure out what could possibly be causing the inconsistency. Am I doing anything wrong here?

Here is the filter that I am using on the query:

const filter = {
  property: '_Inbox?',
  formula: {
    checkbox: {
      equals: true,
    },
  },
}

The problem is that the response returns me many results for which the formula actually returns false in Notion. Here is an example:

Sample item properties in Notion

Same item inside the API Response

Everything else seems to work fine, apart from that data inconsistency with formulas. It doesn't seem to be a cache issue either as I also get old items for which the formula doesn't match.

Any help would be greatly appreciated. Or at least a confirmation that I'm not crazy and that there is an issue with the Notion API?

Cheers

Upvotes: 6

Views: 2656

Answers (1)

tonigiri
tonigiri

Reputation: 177

Omg finally found out the issue right after posting the question...

If anyone is facing something like this, the reason is that the formula was referencing relation props, that the API didn't have access to 🤦‍♂️

If the Notion team is reading this, I would highly recommend to omit the property instead of silently making it return an incorrect value. An explicit warning would be best, but a missing value would at least make debugging and spotting the issue a little bit easier.

Upvotes: 9

Related Questions