- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 11, 2024 08:14 AM
This is in my body.
{
"records": [
{
"fields": {
"first": "test",
"second": "test2",
"tel": "000000000",
"email": "test@test.com"
}
}
]
}
And in Airtable my table looks like this:
first | second | tel |
Any help would be good, thanks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 11, 2024 07:20 PM
Are you creating or updating records?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 12, 2024 01:28 AM
I am trying to create an entry.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 12, 2024 10:08 PM
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 })
})
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 13, 2024 01:59 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 15, 2024 06:46 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 15, 2024 06:48 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 15, 2024 08:07 PM
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!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Jul 16, 2024 03:46 AM
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
