Alokai

findCategoryById

Method finding category based on provided ID in Bloomreach Discovery.

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 findCategoryById query.

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

Signature

declare function findCategoryById(
	params: QueryParams<QueryFindCategoryByIdArgs>
): Promise<Category>;

Parameters

NameRequiredTypeDescription
paramsRequiredQueryParams<QueryFindCategoryByIdArgs>Check the type for more information.

Returns

Returns a category.

Referenced Types

Examples

Fetching category by ID.

import { sdk } from '~/sdk';

const id = 'PNB160400000000';
const category = await sdk.brd.findCategoryById({ id });

Fetching category by ID with only specified fields.

import { sdk } from '~/sdk';

const id = 'PNB160400000000';
const category = await sdk.brd.findCategoryById({
 id,
 expect: `
   displayName
   id
 `
});

Fetching category by ID passing query hint.

import { sdk } from '~/sdk';

const id = 'PNB160400000000';
const category = await sdk.brd.findCategoryById({
 id,
 queryHint: {
   brUid2: 'some value'
 }
});

On this page