I’m developing a web project where I want to use Airtable as the backend for my submission form. Unfortunately, I’m encountering an API integration issue where it states that I’m missing some necessary fields in my request. I’m quite new to JavaScript as well as Airtable.
The error I keep getting is: {"error":{"type":"INVALID_REQUEST_MISSING_FIELDS","message":"Could not find field \"fields\" in the request body"}}
yep, looks like your axios params r swapped. the data should be first, and headers in the second obj. also, u need to use .value on each getElementById to get the actual input values. that might be why Airtable’s missing the fields.
Had this exact problem a few months ago with a contact form. You’ve got two issues here. First, yeah, swap the data and config objects in your axios call like everyone said. But here’s what almost made me lose my mind debugging - you’re passing DOM elements instead of values. When you use document.getElementById("name-input") without .value, you’re literally sending the HTML element to Airtable, not what the user typed. Also, drop that extra # in your getElementById calls. If your HTML ID is “name-input”, don’t add the “#” - that’s CSS selector stuff, not what getElementById wants. Pro tip: console.log your data object before sending it. If you see “[object HTMLInputElement]” instead of actual form values, you’ll know what’s wrong immediately. This trick saves me tons of time on API bugs now.
You need that records array wrapper - Airtable won’t accept requests without it. Also ditch the # in your getElementById calls unless your IDs actually have it.
I’ve been there with Airtable’s API. Their docs make the request format way more confusing than it needs to be.