Are you creating or updating records?
Are you creating or updating records?
I am trying to create an entry.
@James311it
I think you are close, try using JSON.stringify() on javascript objects to construct your body payload when making a POST request via the Airtable API.
for example using the body you posted it would look something like this:
//script above
const data = [
{
fields: {
"first": "test",
"second": "test2",
"tel": "000000000",
"email": "test@test.com"
}
}
]
//example fetch call
const res = await fetch(exampleURL, {
method: 'POST',
headers,
body: JSON.stringify({ records: data })
})
I am trying to create an entry.
Hmm, could you provide a screenshot of the fields please? I'd like to try replicating as, with all single line text fields your body works fine for me
Could I confirm you've set your content-type to JSON? Maybe try setting typecast: true as well?
Hmm, could you provide a screenshot of the fields please? I'd like to try replicating as, with all single line text fields your body works fine for me
Could I confirm you've set your content-type to JSON? Maybe try setting typecast: true as well?
Hi,
The table is pretty straightforward, the only difference is I have two base documents.
However I don't see why that would be a problem.

Hi,
The table is pretty straightforward, the only difference is I have two base documents.
However I don't see why that would be a problem.

I have messed with the table's names, and that's why they are different from my post request.
So the table is the original, but I removed the spaces and tried to make the table names shorter when troubleshooting.
Hi,
The table is pretty straightforward, the only difference is I have two base documents.
However I don't see why that would be a problem.

Thanks for the screenshot! Just wanted to check what the field types were as that may be causing an issue!
I take it you've set your content-type to JSON and have tried setting typecast: true as well? If so, I'd suggest opening a ticket with Airtable support directly!
Thanks for the screenshot! Just wanted to check what the field types were as that may be causing an issue!
I take it you've set your content-type to JSON and have tried setting typecast: true as well? If so, I'd suggest opening a ticket with Airtable support directly!
All the table fields are set to single-line text to simplify troubleshooting and avoid potential issues.
I am including a Content-Type header with the value application/json but am not using the typecast parameter set to true