
Overview of listings in the API Builder
Why use listings?
It’s easier to understand by comparing it to components in a frontend framework like React. A listing component takes a list of items and renders them in a grid or list.product-listing.jsx
product-card.jsx
listing.jsx
Input Parameters
Oftentimes, you will want to fetch a list of items based on a certain criteria. For example, you might want to fetch all products in a certain category. Using parameters, you can define the criteria for the list. Parameters can be strings - for example a category ID or arrays - for example a list of product IDs. In the Filter Query card inside the Query tab of the listing, you can map the parameters to query criteria that will be used to filter the results. Parameters are typically controlled by the frontend application based on context (like the current category being viewed), while query options are intended for user-controlled actions such as searching, filtering, and pagination. This separation allows yout to maintain core content relevance while enabling user refinement of results.Listing Settings
Listing settings are used to control how the listing behaves and how it can be queried.

Listing settings in the query tab of a listing
Filter query
The filter query is a pre-defined query that will always be applied to the listing. For example, you might want to fetch all products in a certain category. You can add mulitple query conditions to refine the results.Filter options
Press the Settings button in the query tab to see
filter, search, sorting and pagination settings.
Searchable fields
You can mark fields as searchable to enable a text search on them. This will allow your users to search for items by typing in a search query. Often used for product names, aliases or descriptions. By default, Frontstack will run a fuzzy search on your searchable fields to find the best matches and counteract user typos. You can disable fuzzy search to get exact matches only.Sorting
You can define multiple sorting fields to allow your users to sort the results by different criteria as well as specify the default sorting. For the default sorting, you can also define a default sorting direction (ascending or descending).

Sorting options in the query tab of a listing
Pagination
Lets you define how many items per page are fetched.Fetching a listing
If this is your first time reading, check out how to generate the
client first.
listing
method.
Parameters
If you need to specificy parameters, you can do so by passing them as the second argument to thelisting
method.
Filtering
For applying filters (as defined in the Filter options), you can pass aconfig
object with a query
field as the third argument to the listing
method.
You can filter by all fields that are configured as filter options.
The following filter types are supported:
equals
range
contains
and
,or
andnot
- allows chaining multiple filters
and
filters.
Pagination
To paginate the results, you can pass apage
and a limit
field to the query
object.
Note, that the limit
parameter respects the default and maximum limit set in the pagination settings.
Search
To perform a search, you can pass asearch
field to the query
object.