Dec 21, 2021 10:46 AM
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!
Solved! Go to Solution.
Dec 23, 2021 06:42 AM
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?
Dec 23, 2021 07:15 AM
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.
Dec 23, 2021 05:39 PM
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.