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:
GET /orders?size=10&page=1 HTTP/1.1Content-Type:application/jsonAuthorization:Bearer <jwt>X-Builton-Api-Key:<builton-api-key>Host:api.builton.dev
builton.products.get({ size:10, page:0 }).then(pageProduct => {// pageProduct.current contains the first page.// pageProduct.page contains the current page number.// pageProduct.paginationTotal contains the total number of item you can paginate through.// pageProduct.next() will update `pageProduct.current` and `pageProduct.page` with the next page.// pageProduct.previous() will update `pageProduct.current` and `pageProduct.page` with the previous page.// pageProduct.goToPage(pageNumber) will update `pageProduct.current` and `pageProduct.page` with a specified page.// The `next`, `previous`, and `goToPage` functions accept a callback and return a Promise.});