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====================
--data '{
"records": [
{
"fields": {
"Local Process": "GoogleDriveFS",
"Remote IP Address": "2607:f8b0:4005:814::200a",
"Hostname": "sfo03s32-in-x0a.1e100.net",
"Location": "Mountain View-United States-CA-Google LLC"
}
},
{
"fields": {
"Local Process": "msedge",
"Remote IP Address": "2600:1406:d400::1738:32b",
"Hostname": "g2600-1406-d400-0000-0000-0000-1738-032b.deploy.static.akamaitechnologies.com",
"Location": "San Jose-United States-CA-Akamai International B.V."
}
},
{
"fields": {
"Local Process": "msedge",
"Remote IP Address": "2603:1036:307:48df::2",
"Hostname": "Unable to resolve hostname",
"Location": "San Jose-United States-CA-Microsoft Corporation"
}
},
{
"fields": {
"Local Process": "GoogleDriveFS",
"Remote IP Address": "2607:f8b0:4005:80e::200a",
"Hostname": "nuq04s39-in-x0a.1e100.net",
"Location": "Mountain View-United States-CA-Google LLC"
}
},
{
"fields": {
"Local Process": "GoogleDriveFS",
"Remote IP Address": "2607:f8b0:4005:80e::200a",
"Hostname": "nuq04s39-in-x0a.1e100.net",
"Location": "Mountain View-United States-CA-Google LLC"
}
},
{
"fields": {
"Local Process": "msedge",
"Remote IP Address": "2603:1036:2400::22",
"Hostname": "Unable to resolve hostname",
"Location": "San Francisco-United States-CA-Microsoft Corporation"
}
},
{
"fields": {
"Local Process": "msedge",
"Remote IP Address": "2603:1036:2400::22",
"Hostname": "Unable to resolve hostname",
"Location": "San Francisco-United States-CA-Microsoft Corporation"
}
},
{
"fields": {
"Local Process": "OneDrive",
"Remote IP Address": "20.189.173.12",
"Hostname": "Unable to resolve hostname",
"Location": "San Francisco-United States-CA-Microsoft Corporation"
}
}
]
}'