我目前正在尝试使用概念API下载一个网站/页面。我分享了这个页面,并试着这样做:
(async () => {
const pageId = 'abcd-editorial-efe.notion.site/Sites-abc123';
const response = await notion.pages.retrieve({ page_id: pageId });
console.log(response);
})();
我得到一个错误说:
@notionhq/client warn: request fail {
code: 'object_not_found',
message: 'Could not find page with ID: abc123..... Make sure the relevant pages and databases are shared with your integration.'
}
这是检索页面的正确API端点吗?
概念文档pageId是一个GUID…但是当我分享我的页面时,我得到了一个完整的/完整的URL:
(async () => {
const pageId = 'b55c9c91-384d-452b-81db-d1ef79372b75';
const response = await notion.pages.retrieve({ page_id: pageId });
console.log(response);
})();
我使用"@notionhq/client": "^1.0.4"
2022年11月前
你过去不得不邀请像Muhammad Magdi在评论中提到的那样的集成:
在share
部分(右上),选择invite
并邀请您的集成。
2022年11月以后
正如下面[umihico]所述,在最新版本的Notion中,您可以从右上方的"三个点"添加连接。菜单。
看起来您有一个成功的工作空间连接,但是您还没有授予该连接对您的工作空间内的数据库的访问权限。
要做到这一点:
- 点击右上方的3个点。
- 查找"添加连接";
- 在框中搜索您的连接名称。
- 选择并确认连接对数据库的访问。