Create a Table
- Raw
- cURL
- Python
- Javascript / fetch
POST /tables
POST /tables HTTP/1.1
Authorization: Bearer <YOUR_API_TOKEN>
Host: api.lytecms.com
{
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "My Table",
"fields": [
{ "name": "Text", "type": "text" },
{ "name": "Article", "type": "article" },
{ "name": "Single Select", "type": "singleSelect" }
]
}
POST /tables
curl -X POST /tables
-H "Authorization: Bearer <YOUR_API_TOKEN>"
-H "Host: api.lytecms.com"
-d '{
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "My Table",
"fields": [
{ "name": "Text", "type": "text" },
{ "name": "Article", "type": "article" },
{ "name": "Single Select", "type": "singleSelect" }
]
}'
POST /tables
import requests
payload = {
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "My Table",
"fields": [
{ "name": "Text", "type": "text" },
{ "name": "Article", "type": "article" },
{ "name": "Single Select", "type": "singleSelect" }
]
}
r = requests.request(
method="POST",
url="/tables",
headers={
"Authorization": "Bearer <YOUR_API_TOKEN>",
"Host": "api.lytecms.com"
},
json=payload,
)
POST /tables
fetch("/tables", {
method: "POST",
headers: {
"Authorization": "Bearer <YOUR_API_TOKEN>",
"Host": "api.lytecms.com",
},
body: JSON.stringify({
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "My Table",
"fields": [
{ "name": "Text", "type": "text" },
{ "name": "Article", "type": "article" },
{ "name": "Single Select", "type": "singleSelect" }
]
}),
}).then((response) => console.log(response.json()))
Parameters
{
"project": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "string",
"fields": [
{
"name": "Text",
"type": "text"
},
{
"name": "Article",
"type": "article"
},
{
"name": "Single Select",
"type": "singleSelect"
}
]
Parameter | Type | Required | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
project | string | Yes | ID of the project | ||||||||||||
name | string | Yes | Name of the table | ||||||||||||
fields | list | No | The initial fields of the data table. (click to expand)
Please note:
Data validation rules:
| ||||||||||||
type | string | Yes | Type of the field |
Response
{
"id": "prj_RSe4wbfuHSXelT8rNrMOJSAE",
"name": "Table1",
"created": 1704591821,
"updated": 1704591821
}