I’m writing a php script in which I need to fetch all records from a certain base of about 1000 records (and store them in one array so I can handle some stuff).
As I understand the max pageSize is 100, but with the offset it returns and using this as a parameter in your next request you can get the next pages.
But this doesn’t seem to really work. I can get a few pages (actually sometimes just one) until it throws the error LIST_RECORDS_ITERATOR_NOT_AVAILABLE on me.
I simply never am able to fetch every page. This error always occurs.
How can I proceed from this error to be able to fetch every record? Am I missing something?
A snippet from my code:
//curl code ...
curl_close($ch);
$airtable_response = json_decode($entries, TRUE);
foreach ($airtable_responseo"records"] as $key => $record) {
$all_recordso] = $record;
}
// Next page if there is one
if( $airtable_responseo'offset'] ) {
fetch_records($url . "?offset=" . $airtable_responseo'offset']);
} else {
return $all_records;
}