Help

How do you use the API to list records with field IDs instead of names?

Topic Labels: API
1995 5
cancel
Showing results for 
Search instead for 
Did you mean: 
Michaela_Cesta1
4 - Data Explorer
4 - Data Explorer

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!

5 Replies 5
karansuraj
5 - Automation Enthusiast
5 - Automation Enthusiast

Did you ever find a solution to this anywhere else?

pjmv
4 - Data Explorer
4 - Data Explorer

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.


karansuraj
5 - Automation Enthusiast
5 - Automation Enthusiast

Screenshot 2023-06-01 at 12.10.33 AM.pngSo 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

Hi karansuraj, thanks ! This is super helpful. I did not realize these docs had so much more information than the auto-generated ones. 

karansuraj
5 - Automation Enthusiast
5 - Automation Enthusiast

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.