Create table
Creates a new table in the base
- Parameters
- Advanced call ?
Function CreateTable(Val Token, Val Base, Val Name, Val FieldArray, Val Description = "") Export
| Parameter | CLI option | Type | Required | 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
| Parameter | Description |
|---|---|
| proxy | InternetProxy or a structure with fields Protocol, Host, Port, User, Password, UseOSAuthentication |
| timeout | Request execution timeout |
| adv_response | Formats the response as a complete HTTP structure with fields code, body, and headers |
| retries | Number of HTTP request send attempts on 5** status codes or internal client errors |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
Token = "patNn4BXW66Yx3pdj.5b93c53cab554a8387de02d...";
Base = "appJiRrCJhRhnaVAo";
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);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint airtable CreateTable \
--token "***" \
--base "app86bmgLaVuoXh4T" \
--title "TestTable2" \
--fieldsdata "[{'name':'Number','type':'number','options':{'precision':'0'}},{'name':'String','type':'richText'},{'name':'Attachment','type':'multipleAttachments'},{'name':'Checkbox','type':'checkbox','options':{'icon':'check','color':'yellowBright'}},{'name':'Date','type':'date','options':{'dateFormat':{'format':'YYYY-MM-DD','name':'iso'}}},{'name':'Phone','type':'phoneNumber'},{'name':'Email','type':'email'},{'name':'Link','type':'url'}]" \
--description "NewTable"
:: JSON data can also be passed as a path to a .json file
oint airtable CreateTable ^
--token "***" ^
--base "app86bmgLaVuoXh4T" ^
--title "TestTable2" ^
--fieldsdata "[{'name':'Number','type':'number','options':{'precision':'0'}},{'name':'String','type':'richText'},{'name':'Attachment','type':'multipleAttachments'},{'name':'Checkbox','type':'checkbox','options':{'icon':'check','color':'yellowBright'}},{'name':'Date','type':'date','options':{'dateFormat':{'format':'YYYY-MM-DD','name':'iso'}}},{'name':'Phone','type':'phoneNumber'},{'name':'Email','type':'email'},{'name':'Link','type':'url'}]" ^
--description "NewTable"
Result
{
"id": "tblGKn3wdfOQGs7G3",
"name": "TestTable2",
"description": "NewTable",
"primaryFieldId": "fldzJFzZdPERWIDJ5",
"fields": [
{
"type": "number",
"options": {
"precision": 0
},
"id": "fldzJFzZdPERWIDJ5",
"name": "Number"
},
{
"type": "richText",
"id": "fldMF1aCUHxSxELab",
"name": "String"
},
{
"type": "multipleAttachments",
"options": {
"isReversed": false
},
"id": "fldQB66Pnh0vMr4q7",
"name": "Attachment"
},
{
"type": "checkbox",
"options": {
"icon": "check",
"color": "yellowBright"
},
"id": "fldtpBxr7bkFJlER8",
"name": "Checkbox"
},
{
"type": "date",
"options": {
"dateFormat": {
"name": "iso",
"format": "YYYY-MM-DD"
}
},
"id": "fld1oUVP4S1DdQaTT",
"name": "Date"
},
{
"type": "phoneNumber",
"id": "fldhRyUMHIdsdcf3h",
"name": "Phone"
},
{
"type": "email",
"id": "flda9APjYtjNjZ5TG",
"name": "Email"
},
{
"type": "url",
"id": "fldrlDQhzs13tdJEd",
"name": "Link"
}
],
"views": [
{
"id": "viwgZmI133I2gYv9R",
"name": "Grid view",
"type": "grid"
}
]
}