使用Google Apps Script调用Notion API时遇404错误:无法找到数据库
使用Google Apps Script查询Notion数据库时持续收到404 Not Found错误
我的配置
- 使用Google Apps Script (GAS) 查询Notion 数据库
- Notion API版本:2022-06-28
- 数据库ID:1b950a040a82xxxxxxxxxxxxxxc72fc
- 集成应用:
gas_note_bot_v5(对该数据库拥有完全访问权限) - 使用Postman测试仍返回
404 Not Found错误
我的代码(Google Apps Script)
const NOTION_API_KEY = "ntn_xxxxxxxxxxxxxxxxxxxxxxx"; const DATABASE_ID = "1b950a040a82xxxxxxxxxxxxxxc72fc"; function testNotionAPI() { const url = `https://api.notion.com/v1/databases/${DATABASE_ID}/query`; const options = { method: "post", headers: { "Authorization": `Bearer ${NOTION_API_KEY}`, "Notion-Version": "2022-06-28", "Content-Type": "application/json" }, muteHttpExceptions: true }; const response = UrlFetchApp.fetch(url, options); Logger.log(response.getContentText()); }
错误信息
{ "object": "error", "status": 404, "code": "object_not_found", "message": "Could not find database with ID: 1b950a040a82807b8209e36b588c72fc. Make sure the relevant pages and databases are shared with your integration." }
已尝试的操作
- ✅ 反复核对Notion页面URL中的数据库ID
- ✅ 验证API密钥正确无误
- ✅ 确认集成应用gas_note_bot_v5对数据库拥有完全访问权限
- ✅ 使用Postman查询仍出现404 Not Found错误
内容的提问来源于stack exchange,提问作者ธเนศว์ ตั้งวัจนะโยบาย
相关产品推荐
相关产品推荐

