I want to fetch records from another base (for reasons) to output in the scripting app. My code works but I must be unable to find much documentation on how to paginate Airtable. Is there a better way to get all records?
let offset = '';
while (offset != "stop"){
let response = await fetch(`https://api.airtable.com/v0/${remoteBaseID}/${remoteTableID}?api_key=${apiKey}&offset=${offset}`);
let json = await response.json();
if (json.offset !== undefined){
offset = json.offset
remoteRecords.push(json.records)
}else{
remoteRecords.push(json.records)
break
}
}
Open to suggestions.
