jamalex / jamalex/notion-py

Notion's Jan 9th 2020 API updates break collection querying with filters

Open
#94 10 comments 5 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
4.4k
Forks
470
PR merge metrics
No merged PRs in 30d

Description

I noticed that my usage of collection querying with filters has completely broken down. As of now, the queries are simply returning _everything_ ignoring _filters_.

Looked around and saw the Notion update on Jan 9th, 2020 mentioning _infrastructure upgrades today_. It looks like they changed the API that this project depends on.

I dug around and noticed that the way the _filters_ are handled changed. I'm unsure if other aspects changed (i.e., sort/aggregates) changed as well.

## Old format (notion-py sends this as of v0.0.25))

```
{
"collectionId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"collectionViewId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"loader":{
"limit":10000,
"loadContentCover":true,
"query":"",
"userLocale":"en",
"userTimeZone":"America/Toronto",
"type":"table"
},
"query":{
"aggregate":[

],
"filter":[
{
"property":"^X)Q",
"comparator":"enum_is",
"value":"Current"
}
],
"filter_operator":"and",
"sort":[

]
}
}
```

## New format (notion.so sends this as of Jan 9th, 2020)

```
{
"collectionId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"collectionViewId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"loader":{
"type":"table",
"limit":70,
"searchQuery":"",
"userTimeZone":"America/Toronto",
"userLocale":"en",
"loadContentCover":true
},
"query":{
"sort":[

],
"filter":{
"filters":[
{
"filter":{
"value":{
"type":"exact",
"value":"Current"
},
"operator":"enum_is"
},
"property":"^X)Q"
}
],
"operator":"and"
}
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

No files or tests are named. Start by locating the collection-querying request and its filter serialization, then compare the old and Jan 9th request formats shown here. Done means filtered collection queries work with the updated format, with related sort or aggregate behavior checked if affected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.