Skip to content

查看表。

const TOKEN = '123456';
const BASE_ID = 'abc123';

const url = `https://docs.getgrist.com/api/docs/${BASE_ID}/tables`;
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};

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

查看单表。

const TOKEN = '123456';
const BASE_ID = 'abc123';
const TABLE_NAME = 'Table1';

const url = `https://docs.getgrist.com/api/docs/${BASE_ID}/tables/${TABLE_NAME}/columns`;
const options = {method: 'GET', headers: {Authorization: 'Bearer ' + TOKEN}};

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

联系 math@baima.site