2024-10-15 10:50:56 +03:00
|
|
|
---
|
2024-10-15 10:16:04 +03:00
|
|
|
sidebar_position: 3
|
|
|
|
---
|
|
|
|
|
2024-10-15 10:50:56 +03:00
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
2024-10-15 10:16:04 +03:00
|
|
|
# Create records
|
|
|
|
Creates one or an array of records by description or an array of field value descriptions
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
`Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export`
|
|
|
|
|
2024-10-15 15:15:47 +03:00
|
|
|
| Parameter | CLI option | Type | Required | Description |
|
|
|
|
|-|-|-|-|-|
|
|
|
|
| Token | --token | String | ✔ | Token |
|
|
|
|
| Base | --base | String | ✔ | Database identifier |
|
|
|
|
| Table | --table | String | ✔ | Table identifier |
|
|
|
|
| Data | --data | Structure, Array of Structure | ✔ | Set or array of sets of pairs Key : Value > Field : FieldValue |
|
2024-10-15 10:16:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Airtable
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-15 21:15:56 +03:00
|
|
|
```bsl title="1C:Enterprise/OneScript code example"
|
2024-10-15 10:16:04 +03:00
|
|
|
Token = "patNn4BXW66Yx3pdj.5b93c53cab554a8387de02d...";
|
2025-01-11 21:13:24 +03:00
|
|
|
Base = "appcKJWExq22nSSCZ";
|
|
|
|
Table = "tblfJOUYCIlw7QvTw";
|
2024-10-15 10:16:04 +03:00
|
|
|
|
|
|
|
Number = 10;
|
|
|
|
String = "Hello";
|
|
|
|
|
|
|
|
RowDescription1 = New Structure("Number,String", Number, String);
|
|
|
|
RowDescription2 = New Structure("Number,String", Number, String);
|
|
|
|
|
|
|
|
ArrayOfDescriptions = New Array;
|
|
|
|
ArrayOfDescriptions.Add(RowDescription1);
|
|
|
|
ArrayOfDescriptions.Add(RowDescription2);
|
|
|
|
|
|
|
|
Result = OPI_Airtable.CreatePosts(Token, Base, Table, ArrayOfDescriptions);
|
|
|
|
```
|
|
|
|
|
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
<Tabs>
|
|
|
|
|
|
|
|
<TabItem value="bash" label="Bash" default>
|
|
|
|
```bash
|
2024-10-22 08:59:24 +03:00
|
|
|
# JSON data can also be passed as a path to a .json file
|
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
oint airtable CreatePosts \
|
2024-10-22 08:59:24 +03:00
|
|
|
--token "***" \
|
2025-01-10 12:07:46 +03:00
|
|
|
--base "apprMMfGWJFZxWYR5" \
|
|
|
|
--table "tblsfDOZwPMmsQIg8" \
|
2024-10-22 08:59:24 +03:00
|
|
|
--data "{'Number':10,'String':'Hello'}"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
|
|
|
|
<TabItem value="bat" label="CMD/Bat" default>
|
|
|
|
```batch
|
2024-10-22 08:59:24 +03:00
|
|
|
:: JSON data can also be passed as a path to a .json file
|
|
|
|
|
2024-10-20 22:36:03 +03:00
|
|
|
oint airtable CreatePosts ^
|
2024-10-22 08:59:24 +03:00
|
|
|
--token "***" ^
|
2025-01-10 12:07:46 +03:00
|
|
|
--base "apprMMfGWJFZxWYR5" ^
|
|
|
|
--table "tblsfDOZwPMmsQIg8" ^
|
2024-10-22 08:59:24 +03:00
|
|
|
--data "{'Number':10,'String':'Hello'}"
|
2024-10-20 22:36:03 +03:00
|
|
|
```
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
2024-10-15 10:16:04 +03:00
|
|
|
|
|
|
|
|
|
|
|
```json title="Result"
|
|
|
|
{
|
|
|
|
"records": [
|
|
|
|
{
|
|
|
|
"id": "recVZd6lgdfEkIH0o",
|
|
|
|
"createdTime": "2024-10-09T06:15:48Z",
|
|
|
|
"fields": {
|
|
|
|
"Number": 10,
|
|
|
|
"String": "Hello\n"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "recenScnS1yuI8Dsk",
|
|
|
|
"createdTime": "2024-10-09T06:15:48Z",
|
|
|
|
"fields": {
|
|
|
|
"Number": 10,
|
|
|
|
"String": "Hello\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|