2024-06-05 12:19:46 +02:00
|
|
|
---
|
|
|
|
sidebar_position: 3
|
|
|
|
---
|
|
|
|
|
|
|
|
# Create records
|
|
|
|
Creates one or an array of records by description or an array of field value descriptions
|
|
|
|
|
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
<br/>
|
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
*Function CreatePosts(Val Token, Val Base, Val Table, Val Data) Export*
|
|
|
|
|
|
|
|
| Parameter | CLI option | Type | Destination |
|
|
|
|
|-|-|-|-|
|
|
|
|
| Token | --token | String | Token |
|
|
|
|
| Base | --base | String | Database identifier |
|
|
|
|
| Table | --table | String | Table identifier |
|
2024-06-23 22:22:01 +02:00
|
|
|
| Data | --data | Structure, Array of Structure | Set or array of sets of pairs Key : Value > Field : FieldValue |
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
|
2024-06-06 14:33:52 +02:00
|
|
|
Returns: Map Of KeyAndValue - serialized JSON response from Airtable
|
2024-06-05 12:19:46 +02:00
|
|
|
|
2024-07-10 10:59:55 +02:00
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
```bsl title="Code example"
|
|
|
|
|
|
|
|
Base = "apptm8Xqo7TwMaipQ";
|
|
|
|
Table = "tbl9G4jVoTJpxYwSY";
|
|
|
|
Numeric = 10;
|
|
|
|
StringType = "Hello";
|
|
|
|
|
|
|
|
RowDescription1 = New Structure("Number,String", Numeric, StringType);
|
|
|
|
RowDescription2 = New Structure("Number,String", Numeric, StringType);
|
|
|
|
|
|
|
|
Data = New Array;
|
|
|
|
Data.Add(RowDescription1);
|
|
|
|
Data.Add(RowDescription2);
|
|
|
|
|
|
|
|
Response = OPI_Airtable.CreatePosts(Token, Base, Table, Data); //Map
|
|
|
|
Response = OPI_Tools.JSONString(Response); //JSON string
|
|
|
|
|
|
|
|
```
|
2024-07-10 10:59:55 +02:00
|
|
|
|
|
|
|
|
2024-06-05 12:19:46 +02:00
|
|
|
|
|
|
|
```sh title="CLI command example"
|
|
|
|
|
|
|
|
oint airtable CreatePosts --token %token% --base "apptm8Xqo7TwMaipQ" --table "tbl9G4jVoTJpxYwSY" --data %data%
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
```json title="Result"
|
2024-07-10 10:59:55 +02:00
|
|
|
{
|
2024-06-05 12:19:46 +02:00
|
|
|
"records": [
|
|
|
|
{
|
|
|
|
"id": "recjHNKNZBWLZkZ7A",
|
|
|
|
"createdTime": "2024-05-10T19:39:51Z",
|
|
|
|
"fields": {
|
|
|
|
"Number": 10,
|
|
|
|
"String": "Hello\n"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"id": "recGyJ0MlN1H3GMuN",
|
|
|
|
"createdTime": "2024-05-10T19:39:51Z",
|
|
|
|
"fields": {
|
|
|
|
"Number": 10,
|
|
|
|
"String": "Hello\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|