Help

Airtable API not returning more than 100 records

Topic Labels: API
333 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Ruchika_Abbi1
7 - App Architect
7 - App Architect

Trying to debug code written by someone else. It seems that the following code doesnt return more than 100 records even though fetchnextpage is set.
This seems to have stopped working recently and I'm not sure what has changed. 

return new Promise((resolve, reject) => {
base(tableName).select({
maxRecords: 100,
view: viewName

}).eachPage(function page(records, fetchNextPage) {
records.forEach(function(record) {
data.push({
----fields----

});
}); }

fetchNextPage();

}, function done(err) {
if (err) { console.error(err); return; }

resolve(data);
});
})

 

3 Replies 3

Hello @Ruchika_Abbi1 
Codes look the same as those given Airtable API instructions.

Just cross-check and check a couple of things to verify errors.
The first common thing is to check how many records are there.
Airtable has recently upgraded its API authentication from an Older use Key to a Token(AuthCode). Just cross-check you use Token with proper permissions.

If it's only paging related issue then see this section on your API reference What are the error codes you get?

dilipborad_0-1712752839763.png

👍

Ruchika_Abbi1
7 - App Architect
7 - App Architect

Looks like I had to remove the following. 

maxRecords: 100

 

I don't think that's maxRecords option matters when you've more than 100 records.
Try that. 🤞