0

I'm experiencing an issue when making a call to query a database (v1/databases/{database_id}/query) that has a Relation property that links to another database.

If there is a row in the database being queried that has more than 24 relationships, then I'm seeing that only the first 24 are being returned (via the API, in the UX everything works fine). For example:

            ...
            "properties": {
                "{database_linked_name}": {
                    "id": "%5C%60S%3C",
                    "type": "relation",
                    "relation": [
                        {
                            "id": "zzz"
                        },
                        {
                            "id": "yyy"
                        },
                        {
                            "id": "xxx"
                        },
                        ...
                        ...
                        only first 24
                    ]
               }

Do I need some kind of pagination logic to get the remaining items? I couldn't find anything related to this in the API.

Thanks

satnam
  • 1,457
  • 4
  • 23
  • 43

2 Answers2

2

So anyone facing the same issue. Notion API restricts the number of property items to 25 per page. That was the issue that I was seeing. To get past it, I had to call the https://api.notion.com/v1/pages/{page_id}/properties/{property_id} endpoint, which allows me to paginate through items.

satnam
  • 1,457
  • 4
  • 23
  • 43
0

I think that:

  1. BE: API: v1/databases/{database_id}/query?page=1&per_page=24
  2. FE: when scroll loadMore: page += 1; `
LihnNguyen
  • 632
  • 4
  • 10