Notion: "Search Objects" by passing Database ID as a variable ? or workaround making API call?

I pass a notion database id via a webhook.
I then connect to corresponding Notion database.

After this, i’d like to Search Objects so that I can retrieve only some Pages with a specific filter on a property (eg “Name”=“Peter”).

  1. with already made Notion module ‘Search objects’:
    Search Database Items, I put my webhook variable notion_db_id in the Database ID field.
    But then I cannot use any filter! Nothing appears, and I cannot seem to connect it to the correct properties.values.

  2. making a direct API call
    via a POST request to query a database https://developers.notion.com/reference/post-database-query

I’m struggling to obtain the correct query string.
I thought passing (in the Query field, not mapped) something like

'{
  "filter": {
    "property": "Name",
    "select": {
        "equals": "Peter"
   }
  }
}'

…would work, but i get the following error

Array of objects expected in parameter ‘qs’.

SO, clearly the format of the data i’m passing in the query string is not correct, and I don’t understand why.
it seems to be a correct JSON structure ?

Can somebody give me some idea so that I can filter the pages of the database with an Database ID passed as a variable and not hardcoded?

Thank you

Hi @Aymeric,

What you want to do is send the,


notion-app

  • profile, messages, bookmarks and preferences

Notion: “Search Objects” by passing Database ID as a variable ? or workaround making API call?

Nerd-Zone

notion-app

1

/

2

Aymeric

3

4d

I pass a notion database id via a webhook.
I then connect to corresponding Notion database.

After this, i’d like to Search Objects so that I can retrieve only some Pages with a specific filter on a property (eg “Name”=“Peter”).

  1. with already made Notion module ‘Search objects’:
    Search Database Items, I put my webhook variable notion_db_id in the Database ID field.
    But then I cannot use any filter! Nothing appears, and I cannot seem to connect it to the correct properties.values.
  2. making a direct API call
    via a POST request to query a database Query a database

I’m struggling to obtain the correct query string.
I thought passing (in the Query field, not mapped) something like

'{
  "filter": {
    "property": "Name",
    "select": {
        "equals": "Peter"
   }
  }
}

As part of the BODY not the querystring, so the method is POST, and just use that in Body section.

1 Like