LDMWEB
LDMWEBโ€ข7mo ago

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:
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"...
No description
Jump to solution
13 Replies
LDMWEB
LDMWEBโ€ข7mo ago
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
No description
LDMWEB
LDMWEBโ€ข7mo ago
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
No description
Harini
Hariniโ€ข7mo ago
@Bhavya could you help check this?
Bhavya
Bhavyaโ€ข7mo ago
Sure, I'm on it!
LDMWEB
LDMWEBโ€ข7mo ago
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
Bhavya
Bhavyaโ€ข7mo ago
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"
"title": {
"contains": "yas"
},
...
{
"or": [
"property": "First Name"
"title": {
"contains": "yas"
},
...
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.
No description
LDMWEB
LDMWEBโ€ข7mo ago
@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? ๐Ÿง
Bhavya
Bhavyaโ€ข7mo ago
Nice catch! I updated the node to add the sort functionality as well now. You can refresh and clone the node again ๐Ÿ™‚
LDMWEB
LDMWEBโ€ข7mo ago
@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" } ] }
No description
Bhavya
Bhavyaโ€ข7mo ago
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.
No description
LDMWEB
LDMWEBโ€ข7mo ago
Ah, got the new version, my bad But then how can I split my body request for the filter and for the sort? ๐Ÿคจ
LDMWEB
LDMWEBโ€ข7mo ago
something like this?
No description
LDMWEB
LDMWEBโ€ข7mo ago
got it working, thanks