curl --request POST \
--url https://app.teable.ai/api/base/%7BbaseId%7D/table/ \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"name":"string","dbTableName":"string","description":"string","icon":"string","fields":[{"type":"singleSelect","name":"string","unique":true,"notNull":true,"dbFieldName":"string","isLookup":true,"isConditionalLookup":true,"description":"this is a summary","lookupOptions":{"foreignTableId":"string","lookupFieldId":"string","linkFieldId":"string","filter":{}},"options":{"expression":"countall({values})","timeZone":"string","formatting":null,"showAs":{"type":"url"}},"aiConfig":{"modelKey":"string","isAutoFill":true,"attachPrompt":"string","type":"extraction","sourceFieldId":"string"},"id":"fldxxxxxxxxxxxxxxxx","order":{"viewId":"string","orderIndex":0}}],"views":[{"name":"string","type":"grid","description":"string","order":0,"options":{"rowHeight":"short","fieldNameDisplayLines":1,"frozenColumnCount":0,"frozenFieldId":"string"},"sort":{"sortObjs":[{"fieldId":"string","order":"asc"}],"manualSort":true},"filter":{},"group":[{"fieldId":"string","order":"asc"}],"isLocked":true,"shareId":"string","enableShare":true,"shareMeta":{"allowCopy":true,"includeHiddenField":true,"password":"string","includeRecords":true,"submit":{"allow":true,"requireLogin":true}},"columnMeta":{"property1":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"},"property2":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"}}}],"records":[{"fields":{"single line text":"text value"}}],"order":0,"fieldKeyType":"id"}'const url = 'https://app.teable.ai/api/base/%7BbaseId%7D/table/';
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
},
body: '{"name":"string","dbTableName":"string","description":"string","icon":"string","fields":[{"type":"singleSelect","name":"string","unique":true,"notNull":true,"dbFieldName":"string","isLookup":true,"isConditionalLookup":true,"description":"this is a summary","lookupOptions":{"foreignTableId":"string","lookupFieldId":"string","linkFieldId":"string","filter":{}},"options":{"expression":"countall({values})","timeZone":"string","formatting":null,"showAs":{"type":"url"}},"aiConfig":{"modelKey":"string","isAutoFill":true,"attachPrompt":"string","type":"extraction","sourceFieldId":"string"},"id":"fldxxxxxxxxxxxxxxxx","order":{"viewId":"string","orderIndex":0}}],"views":[{"name":"string","type":"grid","description":"string","order":0,"options":{"rowHeight":"short","fieldNameDisplayLines":1,"frozenColumnCount":0,"frozenFieldId":"string"},"sort":{"sortObjs":[{"fieldId":"string","order":"asc"}],"manualSort":true},"filter":{},"group":[{"fieldId":"string","order":"asc"}],"isLocked":true,"shareId":"string","enableShare":true,"shareMeta":{"allowCopy":true,"includeHiddenField":true,"password":"string","includeRecords":true,"submit":{"allow":true,"requireLogin":true}},"columnMeta":{"property1":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"},"property2":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"}}}],"records":[{"fields":{"single line text":"text value"}}],"order":0,"fieldKeyType":"id"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}const http = require('https');
const options = {
method: 'POST',
hostname: 'app.teable.ai',
port: null,
path: '/api/base/%7BbaseId%7D/table/',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
name: 'string',
dbTableName: 'string',
description: 'string',
icon: 'string',
fields: [
{
type: 'singleSelect',
name: 'string',
unique: true,
notNull: true,
dbFieldName: 'string',
isLookup: true,
isConditionalLookup: true,
description: 'this is a summary',
lookupOptions: {
foreignTableId: 'string',
lookupFieldId: 'string',
linkFieldId: 'string',
filter: {}
},
options: {
expression: 'countall({values})',
timeZone: 'string',
formatting: null,
showAs: {type: 'url'}
},
aiConfig: {
modelKey: 'string',
isAutoFill: true,
attachPrompt: 'string',
type: 'extraction',
sourceFieldId: 'string'
},
id: 'fldxxxxxxxxxxxxxxxx',
order: {viewId: 'string', orderIndex: 0}
}
],
views: [
{
name: 'string',
type: 'grid',
description: 'string',
order: 0,
options: {
rowHeight: 'short',
fieldNameDisplayLines: 1,
frozenColumnCount: 0,
frozenFieldId: 'string'
},
sort: {sortObjs: [{fieldId: 'string', order: 'asc'}], manualSort: true},
filter: {},
group: [{fieldId: 'string', order: 'asc'}],
isLocked: true,
shareId: 'string',
enableShare: true,
shareMeta: {
allowCopy: true,
includeHiddenField: true,
password: 'string',
includeRecords: true,
submit: {allow: true, requireLogin: true}
},
columnMeta: {
property1: {order: 0, width: 0, hidden: true, statisticFunc: 'count'},
property2: {order: 0, width: 0, hidden: true, statisticFunc: 'count'}
}
}
],
records: [{fields: {'single line text': 'text value'}}],
order: 0,
fieldKeyType: 'id'
}));
req.end();import http.client
conn = http.client.HTTPSConnection("app.teable.ai")
payload = "{\"name\":\"string\",\"dbTableName\":\"string\",\"description\":\"string\",\"icon\":\"string\",\"fields\":[{\"type\":\"singleSelect\",\"name\":\"string\",\"unique\":true,\"notNull\":true,\"dbFieldName\":\"string\",\"isLookup\":true,\"isConditionalLookup\":true,\"description\":\"this is a summary\",\"lookupOptions\":{\"foreignTableId\":\"string\",\"lookupFieldId\":\"string\",\"linkFieldId\":\"string\",\"filter\":{}},\"options\":{\"expression\":\"countall({values})\",\"timeZone\":\"string\",\"formatting\":null,\"showAs\":{\"type\":\"url\"}},\"aiConfig\":{\"modelKey\":\"string\",\"isAutoFill\":true,\"attachPrompt\":\"string\",\"type\":\"extraction\",\"sourceFieldId\":\"string\"},\"id\":\"fldxxxxxxxxxxxxxxxx\",\"order\":{\"viewId\":\"string\",\"orderIndex\":0}}],\"views\":[{\"name\":\"string\",\"type\":\"grid\",\"description\":\"string\",\"order\":0,\"options\":{\"rowHeight\":\"short\",\"fieldNameDisplayLines\":1,\"frozenColumnCount\":0,\"frozenFieldId\":\"string\"},\"sort\":{\"sortObjs\":[{\"fieldId\":\"string\",\"order\":\"asc\"}],\"manualSort\":true},\"filter\":{},\"group\":[{\"fieldId\":\"string\",\"order\":\"asc\"}],\"isLocked\":true,\"shareId\":\"string\",\"enableShare\":true,\"shareMeta\":{\"allowCopy\":true,\"includeHiddenField\":true,\"password\":\"string\",\"includeRecords\":true,\"submit\":{\"allow\":true,\"requireLogin\":true}},\"columnMeta\":{\"property1\":{\"order\":0,\"width\":0,\"hidden\":true,\"statisticFunc\":\"count\"},\"property2\":{\"order\":0,\"width\":0,\"hidden\":true,\"statisticFunc\":\"count\"}}}],\"records\":[{\"fields\":{\"single line text\":\"text value\"}}],\"order\":0,\"fieldKeyType\":\"id\"}"
headers = {
'Authorization': "Bearer REPLACE_BEARER_TOKEN",
'content-type': "application/json"
}
conn.request("POST", "/api/base/%7BbaseId%7D/table/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.teable.ai/api/base/{baseId}/table/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'dbTableName' => '<string>',
'description' => '<string>',
'icon' => '<string>',
'fields' => [
[
'type' => 'singleSelect',
'name' => '<string>',
'unique' => true,
'notNull' => true,
'dbFieldName' => '<string>',
'isLookup' => true,
'isConditionalLookup' => true,
'description' => 'this is a summary',
'lookupOptions' => [
'foreignTableId' => '<string>',
'lookupFieldId' => '<string>',
'linkFieldId' => '<string>',
'filter' => [
]
],
'options' => [
'timeZone' => '<string>',
'formatting' => '<unknown>',
'showAs' => [
]
],
'aiConfig' => [
'modelKey' => '<string>',
'type' => 'extraction',
'sourceFieldId' => '<string>',
'isAutoFill' => true,
'attachPrompt' => '<string>'
],
'id' => 'fldxxxxxxxxxxxxxxxx'
]
],
'views' => [
[
'name' => '<string>',
'description' => '<string>',
'order' => 123,
'options' => [
'fieldNameDisplayLines' => 2,
'frozenColumnCount' => 1,
'frozenFieldId' => '<string>'
],
'sort' => [
'sortObjs' => [
[
'fieldId' => '<string>'
]
],
'manualSort' => true
],
'filter' => [
],
'group' => [
[
'fieldId' => '<string>'
]
],
'isLocked' => true,
'shareId' => '<string>',
'enableShare' => true,
'shareMeta' => [
'allowCopy' => true,
'includeHiddenField' => true,
'password' => '<string>',
'includeRecords' => true,
'submit' => [
'allow' => true,
'requireLogin' => true
]
],
'columnMeta' => [
]
]
],
'records' => [
[
'fields' => [
'single line text' => 'text value'
]
]
],
'order' => 123,
'fieldKeyType' => 'name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.teable.ai/api/base/{baseId}/table/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.teable.ai/api/base/{baseId}/table/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.teable.ai/api/base/{baseId}/table/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"dbTableName": "<string>",
"fields": [
{
"id": "<string>",
"name": "Tags",
"type": "singleSelect",
"options": {
"timeZone": "<string>",
"formatting": "<unknown>",
"showAs": {}
},
"dbFieldName": "<string>",
"description": "this is a summary",
"meta": {
"persistedAsGeneratedColumn": false
},
"aiConfig": {
"modelKey": "<string>",
"type": "extraction",
"sourceFieldId": "<string>",
"isAutoFill": true,
"attachPrompt": "<string>"
},
"isLookup": true,
"isConditionalLookup": true,
"lookupOptions": {
"foreignTableId": "<string>",
"lookupFieldId": "<string>",
"fkHostTableName": "<string>",
"selfKeyName": "<string>",
"foreignKeyName": "<string>",
"linkFieldId": "<string>",
"baseId": "<string>",
"filter": {}
},
"notNull": true,
"unique": true,
"isPrimary": true,
"isComputed": true,
"isPending": true,
"hasError": true,
"isMultipleCellValue": true,
"recordRead": true,
"recordCreate": true
}
],
"views": [
{
"id": "<string>",
"name": "<string>",
"createdBy": "<string>",
"createdTime": "<string>",
"columnMeta": {},
"description": "<string>",
"order": 123,
"options": {
"fieldNameDisplayLines": 2,
"frozenColumnCount": 1,
"frozenFieldId": "<string>"
},
"sort": {
"sortObjs": [
{
"fieldId": "<string>"
}
],
"manualSort": true
},
"filter": {},
"group": [
{
"fieldId": "<string>"
}
],
"isLocked": true,
"shareId": "<string>",
"enableShare": true,
"shareMeta": {
"allowCopy": true,
"includeHiddenField": true,
"password": "<string>",
"includeRecords": true,
"submit": {
"allow": true,
"requireLogin": true
}
},
"lastModifiedBy": "<string>",
"lastModifiedTime": "<string>",
"pluginId": "<string>"
}
],
"records": [
{
"id": "<string>",
"fields": {},
"name": "<string>",
"autoNumber": 123,
"createdTime": "<string>",
"lastModifiedTime": "<string>",
"createdBy": "<string>",
"lastModifiedBy": "<string>",
"permissions": {},
"undeletable": true
}
],
"description": "<string>",
"icon": "<string>",
"order": 123,
"lastModifiedTime": "<string>",
"defaultViewId": "<string>"
}Create table
Create a new table in the specified base with customizable fields, views, and initial records. Default configurations will be applied if not specified.
curl --request POST \
--url https://app.teable.ai/api/base/%7BbaseId%7D/table/ \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'content-type: application/json' \
--data '{"name":"string","dbTableName":"string","description":"string","icon":"string","fields":[{"type":"singleSelect","name":"string","unique":true,"notNull":true,"dbFieldName":"string","isLookup":true,"isConditionalLookup":true,"description":"this is a summary","lookupOptions":{"foreignTableId":"string","lookupFieldId":"string","linkFieldId":"string","filter":{}},"options":{"expression":"countall({values})","timeZone":"string","formatting":null,"showAs":{"type":"url"}},"aiConfig":{"modelKey":"string","isAutoFill":true,"attachPrompt":"string","type":"extraction","sourceFieldId":"string"},"id":"fldxxxxxxxxxxxxxxxx","order":{"viewId":"string","orderIndex":0}}],"views":[{"name":"string","type":"grid","description":"string","order":0,"options":{"rowHeight":"short","fieldNameDisplayLines":1,"frozenColumnCount":0,"frozenFieldId":"string"},"sort":{"sortObjs":[{"fieldId":"string","order":"asc"}],"manualSort":true},"filter":{},"group":[{"fieldId":"string","order":"asc"}],"isLocked":true,"shareId":"string","enableShare":true,"shareMeta":{"allowCopy":true,"includeHiddenField":true,"password":"string","includeRecords":true,"submit":{"allow":true,"requireLogin":true}},"columnMeta":{"property1":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"},"property2":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"}}}],"records":[{"fields":{"single line text":"text value"}}],"order":0,"fieldKeyType":"id"}'const url = 'https://app.teable.ai/api/base/%7BbaseId%7D/table/';
const options = {
method: 'POST',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
},
body: '{"name":"string","dbTableName":"string","description":"string","icon":"string","fields":[{"type":"singleSelect","name":"string","unique":true,"notNull":true,"dbFieldName":"string","isLookup":true,"isConditionalLookup":true,"description":"this is a summary","lookupOptions":{"foreignTableId":"string","lookupFieldId":"string","linkFieldId":"string","filter":{}},"options":{"expression":"countall({values})","timeZone":"string","formatting":null,"showAs":{"type":"url"}},"aiConfig":{"modelKey":"string","isAutoFill":true,"attachPrompt":"string","type":"extraction","sourceFieldId":"string"},"id":"fldxxxxxxxxxxxxxxxx","order":{"viewId":"string","orderIndex":0}}],"views":[{"name":"string","type":"grid","description":"string","order":0,"options":{"rowHeight":"short","fieldNameDisplayLines":1,"frozenColumnCount":0,"frozenFieldId":"string"},"sort":{"sortObjs":[{"fieldId":"string","order":"asc"}],"manualSort":true},"filter":{},"group":[{"fieldId":"string","order":"asc"}],"isLocked":true,"shareId":"string","enableShare":true,"shareMeta":{"allowCopy":true,"includeHiddenField":true,"password":"string","includeRecords":true,"submit":{"allow":true,"requireLogin":true}},"columnMeta":{"property1":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"},"property2":{"order":0,"width":0,"hidden":true,"statisticFunc":"count"}}}],"records":[{"fields":{"single line text":"text value"}}],"order":0,"fieldKeyType":"id"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}const http = require('https');
const options = {
method: 'POST',
hostname: 'app.teable.ai',
port: null,
path: '/api/base/%7BbaseId%7D/table/',
headers: {
Authorization: 'Bearer REPLACE_BEARER_TOKEN',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
name: 'string',
dbTableName: 'string',
description: 'string',
icon: 'string',
fields: [
{
type: 'singleSelect',
name: 'string',
unique: true,
notNull: true,
dbFieldName: 'string',
isLookup: true,
isConditionalLookup: true,
description: 'this is a summary',
lookupOptions: {
foreignTableId: 'string',
lookupFieldId: 'string',
linkFieldId: 'string',
filter: {}
},
options: {
expression: 'countall({values})',
timeZone: 'string',
formatting: null,
showAs: {type: 'url'}
},
aiConfig: {
modelKey: 'string',
isAutoFill: true,
attachPrompt: 'string',
type: 'extraction',
sourceFieldId: 'string'
},
id: 'fldxxxxxxxxxxxxxxxx',
order: {viewId: 'string', orderIndex: 0}
}
],
views: [
{
name: 'string',
type: 'grid',
description: 'string',
order: 0,
options: {
rowHeight: 'short',
fieldNameDisplayLines: 1,
frozenColumnCount: 0,
frozenFieldId: 'string'
},
sort: {sortObjs: [{fieldId: 'string', order: 'asc'}], manualSort: true},
filter: {},
group: [{fieldId: 'string', order: 'asc'}],
isLocked: true,
shareId: 'string',
enableShare: true,
shareMeta: {
allowCopy: true,
includeHiddenField: true,
password: 'string',
includeRecords: true,
submit: {allow: true, requireLogin: true}
},
columnMeta: {
property1: {order: 0, width: 0, hidden: true, statisticFunc: 'count'},
property2: {order: 0, width: 0, hidden: true, statisticFunc: 'count'}
}
}
],
records: [{fields: {'single line text': 'text value'}}],
order: 0,
fieldKeyType: 'id'
}));
req.end();import http.client
conn = http.client.HTTPSConnection("app.teable.ai")
payload = "{\"name\":\"string\",\"dbTableName\":\"string\",\"description\":\"string\",\"icon\":\"string\",\"fields\":[{\"type\":\"singleSelect\",\"name\":\"string\",\"unique\":true,\"notNull\":true,\"dbFieldName\":\"string\",\"isLookup\":true,\"isConditionalLookup\":true,\"description\":\"this is a summary\",\"lookupOptions\":{\"foreignTableId\":\"string\",\"lookupFieldId\":\"string\",\"linkFieldId\":\"string\",\"filter\":{}},\"options\":{\"expression\":\"countall({values})\",\"timeZone\":\"string\",\"formatting\":null,\"showAs\":{\"type\":\"url\"}},\"aiConfig\":{\"modelKey\":\"string\",\"isAutoFill\":true,\"attachPrompt\":\"string\",\"type\":\"extraction\",\"sourceFieldId\":\"string\"},\"id\":\"fldxxxxxxxxxxxxxxxx\",\"order\":{\"viewId\":\"string\",\"orderIndex\":0}}],\"views\":[{\"name\":\"string\",\"type\":\"grid\",\"description\":\"string\",\"order\":0,\"options\":{\"rowHeight\":\"short\",\"fieldNameDisplayLines\":1,\"frozenColumnCount\":0,\"frozenFieldId\":\"string\"},\"sort\":{\"sortObjs\":[{\"fieldId\":\"string\",\"order\":\"asc\"}],\"manualSort\":true},\"filter\":{},\"group\":[{\"fieldId\":\"string\",\"order\":\"asc\"}],\"isLocked\":true,\"shareId\":\"string\",\"enableShare\":true,\"shareMeta\":{\"allowCopy\":true,\"includeHiddenField\":true,\"password\":\"string\",\"includeRecords\":true,\"submit\":{\"allow\":true,\"requireLogin\":true}},\"columnMeta\":{\"property1\":{\"order\":0,\"width\":0,\"hidden\":true,\"statisticFunc\":\"count\"},\"property2\":{\"order\":0,\"width\":0,\"hidden\":true,\"statisticFunc\":\"count\"}}}],\"records\":[{\"fields\":{\"single line text\":\"text value\"}}],\"order\":0,\"fieldKeyType\":\"id\"}"
headers = {
'Authorization': "Bearer REPLACE_BEARER_TOKEN",
'content-type': "application/json"
}
conn.request("POST", "/api/base/%7BbaseId%7D/table/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.teable.ai/api/base/{baseId}/table/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'dbTableName' => '<string>',
'description' => '<string>',
'icon' => '<string>',
'fields' => [
[
'type' => 'singleSelect',
'name' => '<string>',
'unique' => true,
'notNull' => true,
'dbFieldName' => '<string>',
'isLookup' => true,
'isConditionalLookup' => true,
'description' => 'this is a summary',
'lookupOptions' => [
'foreignTableId' => '<string>',
'lookupFieldId' => '<string>',
'linkFieldId' => '<string>',
'filter' => [
]
],
'options' => [
'timeZone' => '<string>',
'formatting' => '<unknown>',
'showAs' => [
]
],
'aiConfig' => [
'modelKey' => '<string>',
'type' => 'extraction',
'sourceFieldId' => '<string>',
'isAutoFill' => true,
'attachPrompt' => '<string>'
],
'id' => 'fldxxxxxxxxxxxxxxxx'
]
],
'views' => [
[
'name' => '<string>',
'description' => '<string>',
'order' => 123,
'options' => [
'fieldNameDisplayLines' => 2,
'frozenColumnCount' => 1,
'frozenFieldId' => '<string>'
],
'sort' => [
'sortObjs' => [
[
'fieldId' => '<string>'
]
],
'manualSort' => true
],
'filter' => [
],
'group' => [
[
'fieldId' => '<string>'
]
],
'isLocked' => true,
'shareId' => '<string>',
'enableShare' => true,
'shareMeta' => [
'allowCopy' => true,
'includeHiddenField' => true,
'password' => '<string>',
'includeRecords' => true,
'submit' => [
'allow' => true,
'requireLogin' => true
]
],
'columnMeta' => [
]
]
],
'records' => [
[
'fields' => [
'single line text' => 'text value'
]
]
],
'order' => 123,
'fieldKeyType' => 'name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.teable.ai/api/base/{baseId}/table/"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.teable.ai/api/base/{baseId}/table/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.teable.ai/api/base/{baseId}/table/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"dbTableName\": \"<string>\",\n \"description\": \"<string>\",\n \"icon\": \"<string>\",\n \"fields\": [\n {\n \"type\": \"singleSelect\",\n \"name\": \"<string>\",\n \"unique\": true,\n \"notNull\": true,\n \"dbFieldName\": \"<string>\",\n \"isLookup\": true,\n \"isConditionalLookup\": true,\n \"description\": \"this is a summary\",\n \"lookupOptions\": {\n \"foreignTableId\": \"<string>\",\n \"lookupFieldId\": \"<string>\",\n \"linkFieldId\": \"<string>\",\n \"filter\": {}\n },\n \"options\": {\n \"timeZone\": \"<string>\",\n \"formatting\": \"<unknown>\",\n \"showAs\": {}\n },\n \"aiConfig\": {\n \"modelKey\": \"<string>\",\n \"type\": \"extraction\",\n \"sourceFieldId\": \"<string>\",\n \"isAutoFill\": true,\n \"attachPrompt\": \"<string>\"\n },\n \"id\": \"fldxxxxxxxxxxxxxxxx\"\n }\n ],\n \"views\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"order\": 123,\n \"options\": {\n \"fieldNameDisplayLines\": 2,\n \"frozenColumnCount\": 1,\n \"frozenFieldId\": \"<string>\"\n },\n \"sort\": {\n \"sortObjs\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"manualSort\": true\n },\n \"filter\": {},\n \"group\": [\n {\n \"fieldId\": \"<string>\"\n }\n ],\n \"isLocked\": true,\n \"shareId\": \"<string>\",\n \"enableShare\": true,\n \"shareMeta\": {\n \"allowCopy\": true,\n \"includeHiddenField\": true,\n \"password\": \"<string>\",\n \"includeRecords\": true,\n \"submit\": {\n \"allow\": true,\n \"requireLogin\": true\n }\n },\n \"columnMeta\": {}\n }\n ],\n \"records\": [\n {\n \"fields\": {\n \"single line text\": \"text value\"\n }\n }\n ],\n \"order\": 123,\n \"fieldKeyType\": \"name\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"dbTableName": "<string>",
"fields": [
{
"id": "<string>",
"name": "Tags",
"type": "singleSelect",
"options": {
"timeZone": "<string>",
"formatting": "<unknown>",
"showAs": {}
},
"dbFieldName": "<string>",
"description": "this is a summary",
"meta": {
"persistedAsGeneratedColumn": false
},
"aiConfig": {
"modelKey": "<string>",
"type": "extraction",
"sourceFieldId": "<string>",
"isAutoFill": true,
"attachPrompt": "<string>"
},
"isLookup": true,
"isConditionalLookup": true,
"lookupOptions": {
"foreignTableId": "<string>",
"lookupFieldId": "<string>",
"fkHostTableName": "<string>",
"selfKeyName": "<string>",
"foreignKeyName": "<string>",
"linkFieldId": "<string>",
"baseId": "<string>",
"filter": {}
},
"notNull": true,
"unique": true,
"isPrimary": true,
"isComputed": true,
"isPending": true,
"hasError": true,
"isMultipleCellValue": true,
"recordRead": true,
"recordCreate": true
}
],
"views": [
{
"id": "<string>",
"name": "<string>",
"createdBy": "<string>",
"createdTime": "<string>",
"columnMeta": {},
"description": "<string>",
"order": 123,
"options": {
"fieldNameDisplayLines": 2,
"frozenColumnCount": 1,
"frozenFieldId": "<string>"
},
"sort": {
"sortObjs": [
{
"fieldId": "<string>"
}
],
"manualSort": true
},
"filter": {},
"group": [
{
"fieldId": "<string>"
}
],
"isLocked": true,
"shareId": "<string>",
"enableShare": true,
"shareMeta": {
"allowCopy": true,
"includeHiddenField": true,
"password": "<string>",
"includeRecords": true,
"submit": {
"allow": true,
"requireLogin": true
}
},
"lastModifiedBy": "<string>",
"lastModifiedTime": "<string>",
"pluginId": "<string>"
}
],
"records": [
{
"id": "<string>",
"fields": {},
"name": "<string>",
"autoNumber": 123,
"createdTime": "<string>",
"lastModifiedTime": "<string>",
"createdBy": "<string>",
"lastModifiedBy": "<string>",
"permissions": {},
"undeletable": true
}
],
"description": "<string>",
"icon": "<string>",
"order": 123,
"lastModifiedTime": "<string>",
"defaultViewId": "<string>"
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
路径参数
请求体
params for create a table
1Table name in backend database. Limitation: 1-63 characters, start with letter, can only contain letters, numbers and underscore, case insensitive, cannot be duplicated with existing db table name in the base.
^[a-z]\w{0,62}$/iThe description of the table.
The emoji icon string of the table.
The fields of the table. If it is empty, 3 fields include SingleLineText, Number, SingleSelect will and 3 empty records be generated by default.
Show child attributes
Show child attributes
The views of the table. If it is empty, a grid view will be generated by default.
Show child attributes
Show child attributes
The record data of the table. If it is empty, 3 empty records will be generated by default.
Show child attributes
Show child attributes
[
{
"fields": { "single line text": "text value" }
}
]
Define the key type of record.fields[key], You can click "systemInfo" in the field edit box to get fieldId or enter the table design screen with all the field details
id, name, dbFieldName 响应
Returns data about a table.
Complete table structure data and initial record data.
The id of table.
The name of the table.
Table name in backend database. Limitation: 1-63 characters, start with letter, can only contain letters, numbers and underscore, case insensitive, cannot be duplicated with existing db table name in the base.
^[a-z]\w{0,62}$/iThe fields of the table.
Show child attributes
Show child attributes
The views of the table.
Show child attributes
Show child attributes
The records of the table.
Show child attributes
Show child attributes
The description of the table.
The emoji icon string of the table.
The last modified time of the table.
The default view id of the table.
此页面对您有帮助吗?

