Pagination
There are 774 local government areas (LGAs) in Nigeria. If a user of this API requests this data, it'll be bad practice to send such a huge payload at once.
WhereAPI limits responses to 20 records by default. But you can override it with the take
query param.
Here's how we would go about requesting the first 40 LGAs in Kano. Pay attention to ?take=40
Our response (First 40 records)
#
SkippingA huge part of paginating is changing the combination of the skip
and take
query params. You can perform skips on WhereAPI with the skip
query param like so.
\
This skips the first 40 entries from the database
#
Pagination with Skip & TakeI'll be adding a few examples of the pagination with skip
& take
later.