You don't want 400,000 items all at once? Paginate!
All our Building Blocks have support for bulk fetches via “list” API methods, e.g. you can list Orders, Users, Payments, Subscriptions, etc. They all share a common structure, taking at least two parameters: size and page.
We use pagination based on a page size and current page. With these parameters, you can retrieve the data the way you want and display it using your own pagination scheme. The return of a response header contains the total count, e.g.: X-Pagination-Total: 212.
Example request using size and page:
Core SDK & Node SDK
Python SDK
GET /orders?size=10&page=1 HTTP/1.1
Content-Type: application/json
Authorization: Bearer <jwt>
X-Builton-Api-Key: <builton-api-key>
builton.products.get({ size: 10, page: 0 }).then(pageProduct => {
// pageProduct.current contains the first page.
// contains the current page number.
// pageProduct.paginationTotal contains the total number of item you can paginate through.
// will update `pageProduct.current` and `` with the next page.
// pageProduct.previous() will update `pageProduct.current` and `` with the previous page.
// pageProduct.goToPage(pageNumber) will update `pageProduct.current` and `` with a specified page.
// The `next`, `previous`, and `goToPage` functions accept a callback and return a Promise.
orders = builton.order().search(size=10, page=0)
You can find an example on using pagination with the Core SDK and the Node SDK here.
The more items you fetch at once, the slowest the response will be.
Copy link