Jan 04, 2024 01:41 PM
Looking at the great PowerShell community posts on GitHub, I cannot find an example of a JSON body formatted for Airtable for multiple records. the following CURL works, APIkey removed. While I can format the JSON Airtable likes for a single record in the payload, I cannot seem to get the script write to wrap the JSON with the "records";[ values that Airtable wants. I currently am trying the following in Powershell but the JSON is not formatted correctly. Any tips? Depth 3 is works for a single record.
#now wrap with fields value Airtable wants
[PSCustomObject]$AirtableRecordsWrap = @{
records = $AirtableWrap
}
# Convert the object to a JSON string depth of 3 is required to get extra '
$jsonBody = $AirtableRecordsWrap | ConvertTo-Json -Depth 4
============this CURL script will work, with API removed====================
Jan 05, 2024 12:31 AM - edited Jan 05, 2024 12:33 AM
Hi,
I never tried using curl to create records, but I can just confirm that your string parsed to object, able to be used for multiple create records. The output is IDs of new created records.
Try to add typecast parameter (see example in API docs)?
Jan 05, 2024 08:41 AM
Thank you Alexey for looking. Typecast would be useful for automatic data conversion from string values. My issue remains getting the JSON formatted correctly. The example you parsed was hand created to be correct. I am trying to create the Record block in the JSON from my data source and cannot figure it out.