Skip to main content
Question

Notion - Query Database API Filters not working


Forum|alt.badge.img

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?

Did this topic help you find an answer to your question?
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

Troy Tessalone
Forum|alt.badge.img+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.


Forum|alt.badge.img
  • Author
  • Beginner
  • 11 replies
  • February 20, 2024
Troy Tessalone wrote:

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


Troy Tessalone
Forum|alt.badge.img+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

 

 


Forum|alt.badge.img
  • Author
  • Beginner
  • 11 replies
  • February 20, 2024

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?


Forum|alt.badge.img
  • Author
  • Beginner
  • 11 replies
  • February 20, 2024
mc_vento wrote:

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.


Troy Tessalone
Forum|alt.badge.img+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?

 


Forum|alt.badge.img
  • Author
  • Beginner
  • 11 replies
  • February 20, 2024

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

Here’s the screenshot:

 


Troy Tessalone
Forum|alt.badge.img+14

@mc_vento 

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

 


Forum|alt.badge.img
  • Author
  • Beginner
  • 11 replies
  • February 21, 2024
Troy Tessalone wrote:

@mc_vento

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

 

 

Got the same output

 


Troy Tessalone
Forum|alt.badge.img+14

@mc_vento 

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