Skip to content

查询单表。

const TOKEN = 'ntn_123456';
const VERSION = '2026-03-11';
const TABLE_ID = 'abc123';

const url = `https://api.notion.com/v1/databases/${TABLE_ID}`;
const options = { method: 'GET', headers: { 'Authorization': 'Bearer ' + TOKEN, 'Notion-Version': VERSION } };

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}

查询单表。

const TOKEN = 'ntn_123456';
const VERSION = '2026-03-11';
const VIEW_ID = 'ab12';

const url = `https://api.notion.com/v1/data_sources/${VIEW_ID}`;
const options = { method: 'GET', headers: { 'Authorization': 'Bearer ' + TOKEN, 'Notion-Version': VERSION } };

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data.properties);
} catch (error) {
  console.error(error);
}

联系 math@baima.site