You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-12-07 23:03:08 +02:00
153 lines
4.4 KiB
Plaintext
Vendored
153 lines
4.4 KiB
Plaintext
Vendored
---
|
|
sidebar_position: 1
|
|
description: Create table and other functions to work with Airtable in the Open Integration Package, a free open-source integration library for 1C:Enterprise 8, OneScript and CLI
|
|
keywords: [1C, 1С, 1С:Enterprise, 1С:Enterprise 8.3, API, Integration, Services, Exchange, OneScript, CLI, Airtable]
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Create table
|
|
Creates a new table in the base
|
|
|
|
|
|
|
|
`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
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
|
Token = "patNn4BXW66Yx3pdj.5b93c53cab554a8387de02d...";
|
|
Base = "app7HgN8N8JXk96nj";
|
|
|
|
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);
|
|
```
|
|
|
|
|
|
<Tabs>
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
```bash
|
|
oint airtable CreateTable \
|
|
--token "***" \
|
|
--base "appd1JtQRWxOoweQg" \
|
|
--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"
|
|
```
|
|
</TabItem>
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
```batch
|
|
oint airtable CreateTable ^
|
|
--token "***" ^
|
|
--base "appd1JtQRWxOoweQg" ^
|
|
--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"
|
|
```
|
|
</TabItem>
|
|
</Tabs>
|
|
|
|
|
|
```json title="Result"
|
|
{
|
|
"id": "tbl1ECxOLd4V6OM9T",
|
|
"name": "TestTable2",
|
|
"description": "NewTable",
|
|
"primaryFieldId": "fldhWwOjg9UhvJ6A2",
|
|
"fields": [
|
|
{
|
|
"type": "number",
|
|
"options": {
|
|
"precision": 0
|
|
},
|
|
"id": "fldhWwOjg9UhvJ6A2",
|
|
"name": "Number"
|
|
},
|
|
{
|
|
"type": "richText",
|
|
"id": "fld8KaCe62SjwSYAk",
|
|
"name": "String"
|
|
},
|
|
{
|
|
"type": "multipleAttachments",
|
|
"options": {
|
|
"isReversed": false
|
|
},
|
|
"id": "fldSWB4hUUyP5Hx30",
|
|
"name": "Attachment"
|
|
},
|
|
{
|
|
"type": "checkbox",
|
|
"options": {
|
|
"icon": "check",
|
|
"color": "yellowBright"
|
|
},
|
|
"id": "fld7UipYF2w9FsoRm",
|
|
"name": "Checkbox"
|
|
},
|
|
{
|
|
"type": "date",
|
|
"options": {
|
|
"dateFormat": {
|
|
"name": "iso",
|
|
"format": "YYYY-MM-DD"
|
|
}
|
|
},
|
|
"id": "fldHVbDsv6ndNp2XZ",
|
|
"name": "Date"
|
|
},
|
|
{
|
|
"type": "phoneNumber",
|
|
"id": "fldYL0IFRMVQCO7gW",
|
|
"name": "Phone"
|
|
},
|
|
{
|
|
"type": "email",
|
|
"id": "fldzsmOGCGjThDsUp",
|
|
"name": "Email"
|
|
},
|
|
{
|
|
"type": "url",
|
|
"id": "fldMWVcVuR9CmKBcD",
|
|
"name": "Link"
|
|
}
|
|
],
|
|
"views": [
|
|
{
|
|
"id": "viwMlZ7T3KyjEufmW",
|
|
"name": "Grid view",
|
|
"type": "grid"
|
|
}
|
|
]
|
|
}
|
|
```
|