Alokai

customQuery

Method allowing to pass any query to the Bloomreach GraphQL Commerce API.

This method sends a GET request to the search endpoint of the Vue Storefront API Middleware. In turn, it receives data from the Bloomreach GraphQL Commerce API using query passed via param.

You can use this method to fetch information about certain item.

Signature

declare function customQuery<Res = any>(
	params: {
  query: string;
}
): Promise<Res>;

Parameters

NameRequiredTypeDescription
paramsRequired{ query: string; }Check the type for more information.

Returns

Returns an item.

Examples

Passing own custom query fetching categories with only displayName field. The method returns a raw response body. Desired data is scoped to the GraphQL query name.

import { sdk } from '~/sdk';

const query = `#graphql
query findCategories($queryHint: QueryHintInput = null) {
  findCategories(queryHint: $queryHint) {
    displayName
  }
}`
const { findCategories: categories } = await sdk.brd.customQuery({
 query
});

On this page