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
| Name | Required | Type | Description |
|---|---|---|---|
params | Required | QueryParams<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'
}
});