Query Notion database not working
Hello all, I am new to buildship and trying to explore a possible Notion integration.
So basically what I am trying to do is query a Notion database using filters to retrieve some specific elements from this database
Now it looks like it does connect correctly to the database, but it just ignores completely the filters and returns all the items in the DB. I have tried the exact same filters on Postman and they returns the correct items so I am not sure if I am doing something wrong or if something is broken ๐ง
This is the workflow, just the Rest call with the body containing the filters, than passing the filters to the Notion node and return the result. I also attached the workflow file.
If anyone have any what's going on please help, I've been stuck on this all day yesterday ๐
Solution:Jump to solution
Hey @LDMWEB, for the second issue with the body validation error, you need to remove the
filter
property and just use the data inside, i.e:
```
{
"or": [
"property": "First Name"...13 Replies
When I test the workflow, I put the filters into the body of the Rest endpoint, and as you can see it returns 3 results which are all my DB items, completely ignoring the filters passed in the body
the exact same filters sent with Postman are returning me only one result which is correct. So not sure if there is an integration issue here or if I am doing something wrong
@Bhavya could you help check this?
Sure, I'm on it!
So, I just created a new workflow, doing the exact same thing with the exact same nodes, sending the exact same body, but now I receive an error from the Notion API ๐
Solution
Hey @LDMWEB, for the second issue with the body validation error, you need to remove the
filter
property and just use the data inside, i.e:
Also, I made some minute modifications to the node to fix the filter issue. Can you refresh the app, clone the node again from the Node Library, and try again? It should work now.@Bhavya Thank you for looking into it, it works now!
So if I understand correctly, the filter filed of the node is only for the filter object content. Does that mean the node does not support the Sort property?
The way it is documented in the nOtion API is that the body of the request should contain one JSON object with both "filter" and "sort" object in it.
{
"filter": {
"or": [
{
"property": "First Name",
"title": {
"contains": "yas"
}
},
{
"property": "Last Name",
"title": {
"contains": "yas"
}
}
]
},
"sorts": [
{
"property": "First Name",
"direction": "ascending"
}
]
}
If I can only pass the filter part then how to sort? ๐งNice catch! I updated the node to add the sort functionality as well now. You can refresh and clone the node again ๐
@Bhavya I am still experiencing the error ๐คจ how should the body look like now?
I tried with this
{
"filter": {
"or": [
{
"property": "First Name",
"title": {
"contains": "yas"
}
},
{
"property": "Last Name",
"title": {
"contains": "yas"
}
}
]
},
"sorts": [
{
"property": "First Name",
"direction": "ascending"
}
]
}
Hey, that looks like the previous version... You need to refresh the app and add the node from the library again... It should look something like this. Also, you can check the node info section (โน๏ธ icon) for sample inputs.
Ah, got the new version, my bad
But then how can I split my body request for the filter and for the sort? ๐คจ
something like this?
got it working, thanks