1
0
mirror of https://github.com/Bayselonarrend/OpenIntegrations.git synced 2025-12-24 00:01:24 +02:00
Files
OpenIntegrations/docs/en/md/Airtable/Table-management/Create-table.md

124 lines
2.6 KiB
Markdown
Raw Normal View History

---
sidebar_position: 1
---
# Create table
Creates a new table in the base
2024-07-10 13:58:29 +03:00
`Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Description = "") Export`
| Parameter | CLI option | Type | Description |
|-|-|-|-|
| Token | --token | String | Token |
| Base | --base | String | Base identifier |
| Name | --title | String | New table name |
| FieldArray | --fieldsdata | Array of Structure | Array of field descriptions |
| Description | --description | String | Table description |
Returns: Map Of KeyAndValue - serialized JSON response from Airtable
2024-07-10 14:05:58 +03:00
<br/>
2024-07-10 13:58:29 +03:00
```bsl title="Code example"
2024-10-02 20:28:02 +03:00
Token = "patNn4BXW66Yx3pdj.5b93c53cab554a8387de02d...";
2024-10-15 10:07:27 +03:00
Base = "appESy99HYCLbuWlV";
2024-10-02 20:28:02 +03:00
FieldArray = New Array;
FieldArray.Add(OPI_Airtable.GetNumberField("Number"));
FieldArray.Add(OPI_Airtable.GetStringField("String"));
FieldArray.Add(OPI_Airtable.GetAttachmentField("Attachment"));
FieldArray.Add(OPI_Airtable.GetCheckboxField("Checkbox"));
FieldArray.Add(OPI_Airtable.GetDateField("Date"));
FieldArray.Add(OPI_Airtable.GetPhoneField("Phone"));
FieldArray.Add(OPI_Airtable.GetEmailField("Email"));
FieldArray.Add(OPI_Airtable.GetLinkField("Link"));
Name = "TestTable2";
Description = "NewTable";
Result = OPI_Airtable.CreateTable(Token, Base, Name, FieldArray, Description);
```
2024-10-15 09:53:37 +03:00
```json title="Result"
2024-10-03 09:45:14 +03:00
{
2024-10-09 09:42:00 +03:00
"id": "tbl1ECxOLd4V6OM9T",
2024-10-03 09:45:14 +03:00
"name": "TestTable2",
"description": "NewTable",
2024-10-09 09:42:00 +03:00
"primaryFieldId": "fldhWwOjg9UhvJ6A2",
2024-10-03 09:45:14 +03:00
"fields": [
{
"type": "number",
"options": {
"precision": 0
},
2024-10-09 09:42:00 +03:00
"id": "fldhWwOjg9UhvJ6A2",
2024-10-03 09:45:14 +03:00
"name": "Number"
},
{
"type": "richText",
2024-10-09 09:42:00 +03:00
"id": "fld8KaCe62SjwSYAk",
2024-10-03 09:45:14 +03:00
"name": "String"
},
{
"type": "multipleAttachments",
"options": {
"isReversed": false
},
2024-10-09 09:42:00 +03:00
"id": "fldSWB4hUUyP5Hx30",
2024-10-03 09:45:14 +03:00
"name": "Attachment"
},
{
"type": "checkbox",
"options": {
"icon": "check",
"color": "yellowBright"
},
2024-10-09 09:42:00 +03:00
"id": "fld7UipYF2w9FsoRm",
2024-10-03 09:45:14 +03:00
"name": "Checkbox"
},
{
"type": "date",
"options": {
"dateFormat": {
"name": "iso",
"format": "YYYY-MM-DD"
}
},
2024-10-09 09:42:00 +03:00
"id": "fldHVbDsv6ndNp2XZ",
2024-10-03 09:45:14 +03:00
"name": "Date"
},
{
"type": "phoneNumber",
2024-10-09 09:42:00 +03:00
"id": "fldYL0IFRMVQCO7gW",
2024-10-03 09:45:14 +03:00
"name": "Phone"
},
{
"type": "email",
2024-10-09 09:42:00 +03:00
"id": "fldzsmOGCGjThDsUp",
2024-10-03 09:45:14 +03:00
"name": "Email"
},
{
"type": "url",
2024-10-09 09:42:00 +03:00
"id": "fldMWVcVuR9CmKBcD",
2024-10-03 09:45:14 +03:00
"name": "Link"
}
],
"views": [
{
2024-10-09 09:42:00 +03:00
"id": "viwMlZ7T3KyjEufmW",
2024-10-03 09:45:14 +03:00
"name": "Grid view",
"type": "grid"
}
]
}
```