Home > widget-integration > FilterAPI > fetchAPI
FilterAPI.fetchAPI() method
Main method to fetch filter API data with caching support
Signature:
fetchAPI(url: string, addition?: FilterAPIAdditionParams): Promise<string | FilterAPIResponse | null>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
url |
string |
Base URL for the filter API |
|
addition |
(Optional) Additional parameters for customizing the request |
Returns:
Promise<string | FilterAPIResponse | null>
Promise resolving to the API response (HTML or JSON)
Example
const result = await api.fetchAPI(
'/collections/summer',
'product-grid',
{
responseType: 'json',
additionParams: { page: 2 }
}
);