Query a database endpoint supports filtering by timestamp
over 2 years ago by Bill Cauchois
When querying a database using filters, you previously were only able to build filters using properties that were explicitly defined in the database schema. We've added a new type of filter for the created timestamp and last edited timestamp of any page within the database. This means you can filter by these attributes, even if the database doesn't have a "Created time" or "Last edited time" property.
You can read more about this filter type here, but as a preview here is how you would filter by the created timestamp:
{
"filter": {
"timestamp": "created_time",
"created_time": {
"past_week": {}
}
}
}
And here's how you would filter by the last edited time:
{
"filter": {
"timestamp": "last_edited_time",
"last_edited_time": {
"after": "2021-05-10"
}
}
}
Note that you can also use this filter type within a compound filter.