Help

Re: Get the number of records in a table via API

Solved
Jump to Solution
4145 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Evgeny_Bylym
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi!

How to determine the number of records / entries in a table via API using curl / php / pyton?

Imagine a table with 12304 entries. Our current stumbling block is the API limit: we can only get 100 entries at a time via the API using PHP. In this regard, we have to make a lot of requests page by page. Then count the number of pages and multiply them by 100. Is there a more elegant way?

Thank you!

12 Replies 12

LOL. Messy? Indeed!!! But that’s Airtable’s middle name (Air-Messy-Table).

The question you must ask -

Is it better to pull down 40,000 items to count them or call (a) which calls (b)?

Polling-based synchronization strategies are really inefficient. They don’t scale and in Airtable’s case, they can dramatically impact end user’s performance. Have you considered an action-based event handler that keeps your data in sync?

I agree with Bill that it is messy but also a better method of getting a record count than the alternative presented.

Having to read all of the records in a table to get the total count is fairly common in database systems.

Airtable webhook automations are still also technically in Alpha, so new features might still get added. Although it isn’t clear if it will ever get out of alpha or if it is under active development or not.

It also wasn’t clear in the original post that the target needing the total was another Airtable base.

I agree. I never disputed that. My comment about messiness was regarding the multi-tiered calling process (Item A calling Item B calling Item C) that was proposed. I still don’t see what’s wrong with reducing the number of calls from two to one by using some form of caching system.

While less risky, you’ll churn through your automation count quite quickly because the automation will be called for every new record. For example, if 100 new records are added at once, it will run 100 times, with each run linking one record. Your description makes it sound like it will only run once for each batch of new records, which is not the case.