I’m working with the Notion REST API to retrieve data from one of my databases, but I’m running into a strange issue. My database has 23 properties total, but when I make API calls to fetch the database or query its contents, I only get back 16 properties through the LIST DB endpoint. This means 7 properties are missing from the API response. I can see all 23 properties when I look at the database directly in Notion, so they definitely exist. Has anyone encountered this before? Is there a limit on how many properties get returned, or am I missing something in my API calls?
class NotionManager:
def __init__(self):
self.client = None
self.db_collection = {}
self.record_ids = []
self.records = {}
def setup_connection(self):
with open('config.yaml') as file:
config = yaml.load(file, Loader=yaml.FullLoader)
API_KEY = config["api_key"]
self.client = Client(auth=API_KEY)
def get_databases(self):
response = self.client.databases.list()
print("Available databases: ")
for db in response["results"]:
db_name = db["title"][0]["plain_text"]
print(db_name)
self.db_collection[db_name] = db["id"]
def fetch_database_records(self, db_name):
database_id = self.db_collection.get(db_name)
result = self.client.databases.query(database_id=database_id)
for record in result["results"]:
print(record)
self.record_ids.append(record["id"])
def get_individual_pages(self):
for record_id in self.record_ids:
page_data = self.client.pages.retrieve(page_id=record_id)
print(page_data)
When I call get_databases(), I see 16 properties returned. When I use fetch_database_records(), I get 14 properties for individual pages. But the actual database has 23 properties. Why aren’t all properties showing up in the API response?