Bloomreach Discovery Web SDK
Welcome to the Bloomreach Discovery Web SDK, a TypeScript SDK designed to interact with the
Bloomreach Discovery APIs. This SDK provides a convenient way to integrate and use the Discovery
data in your applications.
Getting Started
First initialize the SDK by providing a set of account and product catalog specific options
import type { SetupConfiguration } from '@bloomreach/discovery-web-sdk';
import { initialize } from '@bloomreach/discovery-web-sdk';
const config: SetupConfiguration = {
account_id: 1234,
domain_key: 'example_com',
};
initialize(config);
Now we can utilize the exposed methods to retrieve data from the Bloomreach Discovery platform:
Product Search API
import type { ProductSearchOptions } from '@bloomreach/discovery-web-sdk';
import { productSearch } from '@bloomreach/discovery-web-sdk';
const searchOptions: ProductSearchOptions = {
q: 'Generic Metal Pants',
};
const data = await productSearch(searchOptions);
Category API
import type { CategorySearchOptions } from '@bloomreach/discovery-web-sdk';
import { categorySearch } from '@bloomreach/discovery-web-sdk';
const searchOptions: ProductSearchOptions = {
q: 'cat92082',
};
const data = await categorySearch(searchOptions);
Bestseller API
import type { BestsellerOptions } from '@bloomreach/discovery-web-sdk';
import { bestseller } from '@bloomreach/discovery-web-sdk';
const searchOptions: BestsellerOptions = {
q: 'Bolts',
};
const data = await bestseller(searchOptions);
Content Search API
import type { ContentSearchOptions } from '@bloomreach/discovery-web-sdk';
import { contentSearch } from '@bloomreach/discovery-web-sdk';
const searchOptions: ContentSearchOptions = {
catalog_name: 'Flowers',
q: 'Roses',
};
const data = await contentSearch(searchOptions);
Autosuggest API
import type { AutosuggestOptions } from '@bloomreach/discovery-web-sdk';
import { autosuggest } from '@bloomreach/discovery-web-sdk';
const searchOptions: AutosuggestOptions = {
catalog_views: 'product:store1,store2|recipe:premium|articles',
q: 'Roses',
};
const data = await autosuggest(searchOptions);
Contributing
Contributions are welcome! Please read the contributing guidelines before getting started.
License
This project is licensed under the MIT License. See the LICENSE file for details.