Appearance
表
查看库第一张表的信息。
const API_TOKEN = '123456';
// 生成短期令牌
let url = 'https://cloud.seatable.cn/api/v2.1/dtable/app-access-token/';
let options = {method: 'GET', headers: {Authorization: 'Bearer ' + API_TOKEN}};
let token = '';
let uuid = '';
try {
const response = await fetch(url, options);
const json = await response.json();
token = json.access_token;
uuid = json.dtable_uuid;
} catch (error) {
console.error(error);
}
// 获取表的信息
url = 'https://cloud.seatable.cn/api-gateway/api/v2/dtables/' + uuid + '/metadata/';
options = {method: 'GET', headers: {Authorization: 'Bearer ' + token}};
try {
const response = await fetch(url, options);
const json = await response.json();
console.log(json.metadata.tables[0]);
} catch (error) {
console.error(error);
}查看库第一张表的列。
const API_TOKEN = '123456';
// 生成短期令牌
let url = 'https://cloud.seatable.cn/api/v2.1/dtable/app-access-token/';
let options = {method: 'GET', headers: {Authorization: 'Bearer ' + API_TOKEN}};
let token = '';
let uuid = '';
try {
const response = await fetch(url, options);
const json = await response.json();
token = json.access_token;
uuid = json.dtable_uuid;
} catch (error) {
console.error(error);
}
// 获取列的信息
url = 'https://cloud.seatable.cn/api-gateway/api/v2/dtables/' + uuid + '/metadata/';
options = {method: 'GET', headers: {Authorization: 'Bearer ' + token}};
try {
const response = await fetch(url, options);
const json = await response.json();
console.log(json.metadata.tables[0].columns);
} catch (error) {
console.error(error);
}