Limiting number of items returned using the Notion Database API

65 Views Asked by At

I'm trying to get a single row from a Notion database using the API sorted by a date field.

Endpoint: https://api.notion.com/v1/databases/DATABASEID/query

I'm using the filter, sort and page_size conditions in the body request like this:

{
  "filter": {
    "property": "Last published",
    "date": {
      "is_empty": false
    }
  },
    "sorts": [
        {
            "property": "Last published",
            "direction": "ascending"
        }
    ],
    "page_size": 1
}

Response is a list with all the database entries, but I just want one single row as a response. Hence the "page_size": 1 as described in the Notion database API documentation.

What am I doing wrong here?

0

There are 0 best solutions below