Help

Re: API returns record regardless of table name specified?

Solved
Jump to Solution
925 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Mark_Lett
4 - Data Explorer
4 - Data Explorer

Ok first this is the set up:
1 table base
7 separate table tabs with individual table names
Using react and the npm airtable package

I am making a call in the api to retrieve 1 record by its ID.

const base = new Airtable({ apiKey: Key }).base(id);
const table = base(‘table name’);
const recordId = 'recordidfromairtable';

table.find(recordId, function(err, record) {
if (err) {
   console.error(err);
   return;
}
   console.log('Retrieved', record.id);
});

This works and returns the record. However it seems if you change the table name you are searching on as long as it is a valid table name it still returns the record even if it sits in a different table.

Now whilst this is a functionality we are looking for i.e. a search on all tables in a base. This doesn’t feel like this should be working. i.e. if the table name doesn’t contain the recordId then it should fail but it still returns the record regardless of the table you are searching?

After reading various documentation searching all tables does not seem to be functionality that exists currently so I am surprised this is working.

Anyone have any thoughts suggestions or should I report it as a bug?

1 Solution

Accepted Solutions
JonathanBowen
13 - Mars
13 - Mars

Agreed - the table name does not provide any filtering or validation that the record specified comes from the table. In some ways this isn’t surprising as the record ID is unique across the whole of Airtable (I think), so if you specify that record ID, you’re going to find it (as long as the API key is valid for that base). But I agree, the idea of naming the table then this not having any influence seems strange. As this is the official Airtable JS library, reporting this to Airtable support might be the best option.

See Solution in Thread

1 Reply 1
JonathanBowen
13 - Mars
13 - Mars

Agreed - the table name does not provide any filtering or validation that the record specified comes from the table. In some ways this isn’t surprising as the record ID is unique across the whole of Airtable (I think), so if you specify that record ID, you’re going to find it (as long as the API key is valid for that base). But I agree, the idea of naming the table then this not having any influence seems strange. As this is the official Airtable JS library, reporting this to Airtable support might be the best option.