Mar 14, 2022 04:39 PM
I’ve tried to update my code to take advantage of the field IDs instead of using field names. It works great when sending data to Airtable. But when I query Airtable for records, it sends the field name. Is there a way to get Airtable to send the field IDs instead?
Currently, I’m receiving something like this with field names:
{ id: ‘rec2FTSuyeCV042Pa’,
fields: { Person: ‘Steve’, Birthday: ‘1992-03-30’ },
createdTime: ‘2022-03-14T22:32:21.000Z’}
But I want to receive something like this with field ID’s instead:
{ id: ‘rec2FTSuyeCV042Pa’,
fields: { fldF2IRPW6dwD0VDr: ‘Steve’, fldkuv35FqhZPq2GT: ‘1992-03-30’ },
createdTime: ‘2022-03-14T22:32:21.000Z’}
Any help is appreciated!
May 16, 2023 11:12 AM
Did you ever find a solution to this anywhere else?
May 31, 2023 07:32 AM
Hi, is there an official answer for this ? The default behaviour of the API is pretty much a bomb waiting to explode when you have more than, well... one, user.
May 31, 2023 09:19 PM - edited May 31, 2023 09:21 PM
So I finally found a solution but forgot to update my question here. I looked through the query parameters for the List Records API endpoint and found the boolean flag `returnFieldsByFieldId`. This has worked perfectly for me! As with the default behavior of the API though, you'll still have problems if another user happens to delete a field from the table.
You can use this API endpoint to gather tables with field names/ids in a given base, if it helps as well: https://airtable.com/developers/web/api/get-base-schema
Jun 01, 2023 01:32 AM
Hi karansuraj, thanks ! This is super helpful. I did not realize these docs had so much more information than the auto-generated ones.
Jun 01, 2023 07:31 AM
Yeah I'm not happy about the fragmentation of the documentation, especially because I use the NodeJS API and the documentation isn't consistent between the auto-generated docs for the individual bases and these pages I shared, but generally I would use these pages more if you wanna see every option available, even if you're not making a standard web REST request. I DID notice that their NodeJS and python APIs don't always have all of the features the main API reference mentions, though.