Broadleaf Microservices
  • v1.0.0-latest-prod

Categories

Categories within Broadleaf are used to group products. A category can map to a specific URL or may be used solely as a product grouping.

List Categories

Operation

BrowseClient#listCategories(categoryListParams, options);

Parameters

Parameter Type Required? Description

categoryListParams

CategoryListParams

Provide a list of category ids, urls or names to fetch

options

BrowseClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns an array of Category.

Example

Example of retrieving categories by id
const categories = await browseClient.listCategories({
  ids: ['category-1', 'category-2']
});

console.log(categories);

Get Category

Operation

BrowseClient#getCategory(categoryFetchParams, options);

Parameters

Parameter Type Required? Description

categoryFetchParams

CategoryFetchParams

Provide a category id or category url to fetch

options

BrowseClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a Category.

Example

Example of retrieving a category by its url
const category = await browseClient.getCategory({
  url: '/hot-sauce'
});

console.log(category);

Get Category By URL

Operation

BrowseClient#getCategoryByUrl(url, options);

Parameters

Parameter Type Required? Description

url

string

Provide a category url to fetch

options

BrowseClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a Category.

Example

Example of retrieving a category by its url
const category = await browseClient.getCategoryByUrl('/hot-sauce');

console.log(category);

Get Category By ID

Operation

BrowseClient#getCategoryById(id, options);

Parameters

Parameter Type Required? Description

id

string

Provide a category id to fetch

options

BrowseClientCallOptions

Options passed to the HTTP request call to customize the request configuration.

Response

This function returns a Category.

Example

Example of retrieving a category by its id
const category = await browseClient.getCategoryById('123');

console.log(category);