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
| Name | Required | Type | Description |
|---|---|---|---|
modelName | Required | string | The model name for the component, section or page that is fetched. |
builderOptions | Required | GetContentOptions & { 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. |
options | Required | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Promise<BuilderContent[]>
Referenced Types
GetContentOptions- MethodOptions
BuilderContent
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,
}
);