Alokai

getAll

Method constructing requests for fetching many content entries.

This method sends a GET request to the getAll endpoint of the Vue Storefront API Middleware.

Signature

export declare function getAll(
	modelName: string,
	builderOptions?: GetContentOptions & {
    req?: IncomingMessage;
    res?: ServerResponse;
    apiKey?: string;
    authToken?: string;
},
	options?: MethodOptions
): Promise<BuilderContent[]>;

Parameters

NameRequiredTypeDescription
modelNameRequiredstringThe model name for the component, section or page that is fetched.
builderOptionsRequiredGetContentOptions & { req?: IncomingMessage; res?: ServerResponse; apiKey?: string; authToken?: string; }Object containing all optional properties to fetch content e.g.: userAttributes object which allows to specify urlPath of the content or queryString and many more.
optionsRequiredMethodOptionsOptions that can be passed to additionally configure the request or customize the logic in a plugin.

Returns

Promise<BuilderContent[]>

Referenced Types

Examples

Fetching multiple content entries by its model name and additional value.

import { sdk } from '~/sdk.config.ts';

const { data } = await sdk.builder.getAll(
 'banner',
 {
   options: {
     noTargeting: true,
   },
   query: {
     data: {
        additionalValue: 'value'
     }
   },
   enrich: true,
 }
);

On this page