ColinC
BuildShip2y ago
2 replies
Colin

Airtable "Create Records" API Error

I'm trying to use the Airtable "Create Records" API to add multiple records at once. I'm passing the following response from the OpenAI Assistant:

{
  "response": "{\"fields\":[{\"Date\":\"2024-08-06\",\"Item\":\"Duck Eggs\",\"Quantity\":30,\"Unit\":\"unit\",\"Notes\":\"harvested\"},{\"Date\":\"2024-08-06\",\"Item\":\"Chicken Eggs\",\"Quantity\":10,\"Unit\":\"unit\",\"Notes\":\"harvested\"}]}"
}


I need to format this correctly to be used by the Airtable API. I've added an empty node in between to format it correctly, and this is the output:
[{"fields":{"Date":"2024-08-06","Item":"Duck Eggs","Quantity":30,"Unit":"unit","Notes":"harvested"}},{"fields":{"Date":"2024-08-06","Item":"Chicken Eggs","Quantity":10,"Unit":"unit","Notes":"harvested"}}]

It is happening occasionally, but this is NOT happening consistently. Any suggestions to get the appropriate input every time?
Was this page helpful?