Introduction#
All top-level API resources support bulk fetches through "list" API methods, enabling users to retrieve multiple records at once. These methods can be applied to various domain-related lists, such as listing users or companies.Parameters#
The list API methods follow a standardized structure and require at least two parameters:The page
parameter specifies the page index, effectively indicating the page number being requested. The limit
parameter determines the page size, representing the number of data items or rows to be retrieved per page. For instance, if a component displaying a list of companies shows 20 items per page, the limit should be set to 20. The current page number should be provided through the page parameter, and this number should be incremented with each subsequent pagination request to fetch the next set of data.Recommended limit for lists, is 20
Manage pagination by comparing totalRecords with currently fetched records to control data fetching.
Every list GET request includes a property called totalRecords
in the response, along with the list data. This property is essential for managing pagination and determining when to fetch the next set of data. By comparing the total number of records with the number of records currently fetched, you can effectively control the pagination process. If the number of currently fetched records is less than the total records, the facility to fetch the next set of data should remain enabled. Conversely, if all records have been fetched, the data-fetching mechanism can be disabled. This method ensures efficient data retrieval and smooth user experience by dynamically managing the availability of additional data based on the total and currently fetched records.The limit parameter can be tailored to suit the specific domain and context of the component, allowing for flexible data retrieval that aligns with the unique needs and requirements of different applications.
When implementing pagination during an active search, ensure to pass the search keyword along with other specific parameters such as page and limit. This ensures that the search context is maintained while navigating through paginated results seamlessly.By utilizing these parameters effectively, developers can ensure efficient data retrieval and seamless pagination within their applications. The standardized structure of list API methods simplifies the process of managing and accessing large datasets, making it easier to handle extensive lists of users, companies, and other domain-specific records.