Reputation: 61
I have a workspace with 2 databases shared with my integration, basically it works and I get 200 OK code.
That's the function I have, the headers contain the authentication token:
def listDatabases(self):
r = requests.get('https://api.notion.com/v1/databases', headers=self.headers)
if r.status_code == 200:
return r.json()
else:
return r.reason
And this is the result:
Upvotes: 0
Views: 1881
Reputation: 109
I think maybe those database permissions held by integration are inherited from the parent page.
From Notion API Reference (List databases):
Search pages for more details
This endpoint is no longer recommended, use search instead. This endpoint will only return explicitly shared pages, while search will also return child pages within explicitly shared pages.
An easy way to verify is to confirm if "based on xxx" is included under integration in the share option on the database page (not its parent page or inline database). if was, then that database will not return in "list databases" endpoint.
Upvotes: 4
Reputation: 114
I believe it's because you are not sending the database id in the url https://api.notion.com/v1/databases/**database_id**
if you don't specify the database_id it will take the first database which I assume is without any records.
Upvotes: 0