Question

Notion - Query Database API Filters not working

  • 20 February 2024
  • 10 replies
  • 108 views

Hi,

i’m trying to run a zap step that allows me to retrieve from a database only items that match a condition (specifically, have been modifyed within this week).

Here’s the screenshot of my setup:

 

The problem is that my request retrieves the whole database. I tried with every type of filter it still returns the whole thing.

What’s wrong?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

10 replies

Userlevel 7
Badge +14

Hi @mc_vento 

Please link to the Notion API endpoint documentation you used to create the Zap action step for us to have more context, thanks.

Hi @mc_vento 

Please link to the Notion API endpoint documentation you used to create the Zap action step for us to have more context, thanks.

Database Query Endpoint: https://developers.notion.com/reference/post-database-query

Filters Database Entries: https://developers.notion.com/reference/post-database-query-filter

Userlevel 7
Badge +14

@mc_vento

Make sure you have the correct Headers set.

 

If “past_week” is not working, then perhaps try using a different condition.

https://developers.notion.com/reference/post-database-query-filter#date

 

 

The integration allows to avoid filling the headers, they are filled automatically.

I discovered something though, trying to insert the headers. 

This was the outcome after inserting the Notion-Version header:

“Notion-Version header failed validation: Notion-Version header should be `"2021-05-11"`, `"2021-05-13"`, `"2021-08-16"`, `"2022-02-22"`, or `"2022-06-28"`, instead was `"2022-06-28, 2021-08-16"`.”

So, the version in use is the 2021-08-16. Could this be the problem why filters doesn’t goes through?

The integration allows to avoid filling the headers, they are filled automatically.

I discovered something though, trying to insert the headers. 

This was the outcome after inserting the Notion-Version header:

“Notion-Version header failed validation: Notion-Version header should be `"2021-05-11"`, `"2021-05-13"`, `"2021-08-16"`, `"2022-02-22"`, or `"2022-06-28"`, instead was `"2022-06-28, 2021-08-16"`.”

So, the version in use is the 2021-08-16. Could this be the problem why filters doesn’t goes through?

Also, i already tried most of the filters so i guess the problem doesn’t lie there.

Userlevel 7
Badge +14

@mc_vento 

Often, you may still need to set additional Headers, especially for non-GET requests.

Can you post screenshots with how your Headers are set?

 

What i was tell is that adding the headers blows the request up.

Here’s the screenshot:

 

Userlevel 7
Badge +14

@mc_vento 

Try removing the Notion-Version header but keeping the Content-Type header

 

@mc_vento

Try removing the Notion-Version header but keeping the Content-Type header

 

 

Got the same output

 

Userlevel 7
Badge +14

@mc_vento 

You could try using the Custom Action instead of the API Request for Notion.