422 error - Api data to Airtable

Hi, I’m wondering if anyone can help? I am completely new to this and not sure what I am doing wrong.
I am trying to complete a workflow that sends data from an API to Airtable, but I am getting this error:

{
“error”: {
“message”: “You must provide an array of up to 10 record objects, each with an “id” ID field and a “fields” object for cell values.”,
“type”: “INVALID_RECORDS”
}
}

Here is the body:
{
“records”: [
{
“id”: “{jobkey}”,

  "fields": {
    "Company Name": "{company}",
    "id": "{jobkey}",
    "Location": "{formattedLocation}",
    "Application URL": "{url}",
    "description": "{description}",
    "Published date": "{date}",
    "Job Title": "{jobtitle}",
    "Image": "{logo}"
     }
}

]
}`

When looking at ‘view sent request’ it all looks like the data is pulling through.

Many Thanks!

Hey @Hannah,

Welcome to the community! Starting with your JSON Request Body, it looks like the jobkey column is being passed as a record id. The record id is a unique value provided by Airtable that’s linked to every row in your base.

To get those values, use a Pull from Airtable step. You’ll notice a new column called id. We’ll need to use those values and merge them into your API call.

To link your record ids into your Send to an API step, you’ll want to combine your Pull from an API step with your Pull from Airtable step. You’ll want to keep rows that match on a shared column like jobkey from each step.

You’ll then want to format your JSON using the new id column.

{
	"records": [{
		"id": "{id}",

		"fields": {
			"Company Name": "{company}",
			"id": "{jobkey}",
			"Location": "{formattedLocation}",
			"Application URL": "{url}",
			"description": "{description}",
			"Published date": "{date}",
			"Job Title": "{jobtitle}",
			"Image": "{logo}"
		}
	}]
}

Let us know if that helps!

1 Like