Using Server Side Pagination for REST APIs
This guide explains how we can take advantage of server side pagination to reduce the resource load on our backend and frontend.
This guide uses the NASA Open APIs project. An API key can be generated on this page: Generate API key.
-
Create a new table
-
Add a Backend API with a REST API
-
Add the URL
https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=100&api_key=YOUR_KEY
-
Add
{{API1.response}}
into the table's Table Data -
Now change the Pagination type to
server side
in the properties panel -
Add the event handler onPageChange, make it run
API1
-
Modify the API URL by including the page requested by the user through bindings:
https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?sol=100&page={{Table1.pageNo}}&api_key=YOU_API_KEY
The table with server side pagination working: