Guide to Reducing Airtable API Calls
Objective
This guide explains how to reduce Airtable API usage through efficient caching strategies. By implementing Cloudflare caching and Make.com automation, the API load is minimized during page visits.
Tools Used
• Webstudio: To integrate Airtable data via API.
• Airtable: For data storage and management.
• Cloudflare: For content caching.
• Make.com: To automate API requests and manage the cache.
Problem
In Webstudio, data is pulled from Airtable using the API. Each page load results in an API call to Airtable, leading to high API usage if the site receives frequent traffic. Setting up a caching solution can help reduce this load.
Solution Steps
- Enable Cloudflare Caching
In Cloudflare, configure the “Cache everything” rule. This rule caches all page content, so it doesn’t need to be fetched from Airtable on each visit. Cloudflare offers a template for this caching rule, making setup easier.
- Prepare Airtable
Add a LastEdited column in the Airtable bases you’re using. This column logs the last edit date and time, serving as an indicator for data changes.
- Automation with Make.com
• Airtable Watch: Set up a trigger in Make.com that monitors Airtable for any changes. When a record is edited, the Airtable Watch module detects it.
• Update Cloudflare Cache: Use the HTTP Make a request module to interact with the Cloudflare API. This module clears the Cloudflare cache so that a fresh cache is generated automatically upon data changes.
With this setup, any data changes in Airtable trigger a cache update in Cloudflare. If no changes occur, the website continues to load from the Cloudflare cache without burdening the Airtable API.