question-mark

Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

List queries with airtable backend and Rest API / How to do the load more query in the frontend?

See original GitHub issue

Issue Description

Hello,

If I start from the api documentation to make a list requests to a table. We figure out that the call is sequential, so there is no way to call page 4 before having fetched page 1, 2, 3… and the fetchNextPage(); function allow to call next page in the backend.

base('projects').select({
    // Selecting the first 3 records in db:
    maxRecords: 3,
    view: "db"
}).eachPage(function page(records, fetchNextPage) {
    // This function (`page`) will get called for each page of records.

    records.forEach(function(record) {
        console.log('Retrieved', record.get('title'));
    });

    // To fetch the next page of records, call `fetchNextPage`.
    // If there are more records, `page` will get called again.
    // If there are no more records, `done` will get called.
    fetchNextPage();

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

But how can we use that in the front end (using the node.js airtable.js in the backend).

I make a first query from the front. The backend give me only the first 3 results. Then which query should I make from the front so that the backend do no need to make again the query for the first 3 results so that I can get next results ?

If I do all from the frontend, I can assign the fetchNextPage(); to the load more button.

But if I want to use a node.js api ?

Not possible @kasrak

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
eorroecommented, Feb 20, 2018

Please add a way to pass offset value to the firstPage() method to allow this

0reactions
ChristianBell1995commented, Oct 12, 2020

Can we reopen this issue? I would be very grateful for the addition of this feature!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Query multiple records? - Airtable Community
I have a list >700 of customer IDs that I want to know more about. How can I query them in bulk rather...
Read more >
Fetch data with the Airtable API and display it in a React app ...
Now we can use the Table component to display the data. To display it, I'm going to remove the id and createdOn properties...
Read more >
Making REST and SOAP API Requests - Retool Docs
Querying a REST API. Whether you've connected a resource or added a URL directly into the query editor, you can send path and...
Read more >
The Complete Developer's Guide to Airtable - Blog
In these use cases, you'll be using the Airtable REST API directly or ... As the prior query indicates, a base can contain...
Read more >
Displaying Data from Related Tables Using Angular with the ...
The function makes a call to the API Server to retrieve the list of columns for the given table, which populates another drop-down...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found