Category API - Bloomreach Experience - Open Source CMS

Category API

What does the category API do?

The category API sends a category query to retrieve results about products within the categories that you specify. It's very similar to the product search API, which sends a keyword query.

Example request

Here’s an example REST API call for a category query, using the category ID, cat000922.

Request

GET http://core.dxpapi.com/api/v1/core/?
account_id=<Bloomreach Provided Account ID>
&auth_key=jazzhands
&domain_key=example_com
&request_id=8830241055597
&_br_uid_2=uid=7797686432023:v=11.5:ts=1428617911187:hc=55
&ref_url=http://www.example.com/home
&url=http://www.example.com/index.html?q=cat000922
&request_type=search
&rows=20
&start=0
&fl=pid,title,brand,price,sale_price,colors,sizes,thumb_image,price_range,sale_price_range
&q=cat000922
&search_type=category

Notice that this request is very similar to a product search request except that &search_type is set to category instead of keyword.

For Category Pathways you have to use widget.dxpapi.com instead of above endpoint, rest of the parameters remain the same.  

All of the parameters in the call are required parameters for all category calls. Your own category calls might include optional parameters, but must always include these parameters, too. As a category search query, these parameters must be defined with a specific setting:

  • request_type must be set to  search

  • search_type must be set to  category

Request parameters

These are the parameters used in the example request. Every product search request needs these parameters.

Before getting started, read about the Escape characters and encoding here.
 Are you integrating your native mobile app with Bloomreach?
Some of the parameters in your API requests for native mobile apps need different values from those for your site:

● _br_uid_2: Leave your _br_uid_2 parameters empty.
● ref_url: Leave your ref_url parameters empty.
● url: Use a dummy value for your url parameters, such as exampledomain.app.
 

_br_uid_2

A first-party cookie created by the Bloomreach tracking pixel library (BrTrk). This cookie creates a unique, anonymous identifier for every browser or device.

 

The _br_uid_2 cookie is already encoded
Don't encode the cookie parameter value: _br_uid_2. Use this value exactly as it comes. It's already encoded.

&_br_uid_2=uid%3D7797686432023%3Av%3D11.5%3Ats%3D1428617911187%3Ahc%3D55

Value type

string

Example value

&_br_uid_2=uid%3D7797686432023%3Av%3D11.5%3Ats%3D1428617911187%3Ahc%3D55

account_id

Your site's numerical Bloomreach account ID. Your Bloomreach representative gives your site's account ID to you before or during your integration kickoff meeting.

Notify your Representative
If you don't have a Bloomreach account ID, then let your Bloomreach Representativeknow immediately. You can't send any API calls without your account ID.

Value type

integer

Example value

&account_id=<Bloomreach Provided Account ID>

auth_key

The Bloomreach-provided authentication key for the Bloomreach account that's sending the request.

Leave auth_key parameter values empty for client-side calls

If you use client-side calls for any of your Bloomreach requests, then do not enter an auth_key value in those client-side calls. Pass the auth_key with an empty value in client-side calls.

The auth_key value is a private authorization key. If you include your valid auth_key value in client-side calls, then you inadvertently expose that private information to everybody.

Value type

string

Example value

&auth_key=jazzhands

Your own auth_key value looks very different from this example. We're using an odd example value to reinforce the importance of treating this key like you treat other keys like your email login credentials: don't share it.

domain_key

Your site domain's ID, which is provided by Bloomreach. This ID is for the domain that you want to receive your Bloomreach API requests.

This parameter identifies the specific site version when the one account ID hosts multiple site versions with unique characteristics, such as language versions. Bloomreach uses your domain_key parameter value to ensure that only the data that pertains to that site version is used for query and analytics features, such as autosuggestions.

Value type

string

Example value

&domain_key=example_com

fl

The attributes that you want returned in your API response, such as product IDs and prices. All fl parameters must include pid as one of their values. You can include other attributes from your product feed.

Tip
Include all the attributes from your product feed that you want to include in search results, not just the attributes that you want to be returned as objects in your API response. Your search results pages are built from your API responses. Therefore, search results pages can only include attributes that are returned in API responses.

Value type

string

Example value

&fl=pid,title,brand,price,sale_price,thumb_image,url,description

Example value for Content

&fl=cid,title,thumb_image,url,description

Comma-separated values
Separate multiple attributes with a comma: &fl=pid,title,thumb_image,price

q

Your site's category ID.

Value type

string

Example value

&q=cat000922

ref_url

The URL of the page or HTTP referrer where the request is started.

Value type

string

Example value

&ref_url=http://www.example.com/home

Required

Only mandatory if you want to use Targeting

request_id

An ID to track site visitor clicks. We recommend that you generate unique, random values of 13 digits to enable click-tracking.

Bloomreach doesn't automatically enforce the requirements for this parameter. For example, you can enter test as your value for each instance of the request_id parameter without triggering an error message. However, using a unique value allows us to help you if you encounter a problem.

Value type

string

Example value

&request_id=1597706996836

request_type

The type of API request. Choose the value that fits your use case:

  • search
  • suggest
  • jfy
  • mlt
  • thematic

Value type

string (enum)

 

Use search for search API calls
The only correct &request_type value for a category search API call is search.

rows

The number of matching items to return per results page in the API response. The maximum value is 200.

Tip
To enhance performance, limit this value to the number of items that you think is reasonable for a single page of search results.

Value type

integer

Example value

&rows=10

search_type

The type of search. Choose the value that fits your use case:

  • keyword
  • category

Value type

string (enum)

 

Use category for category API calls
The only correct &search_type value for a category search query is category.

start

The number of the first item on a page of results. For example, the first item on the first page is 0, making the start value also 0. The maximum value is 10000.

Value type

integer

Example value

&start=0

url

The absolute URL of the page where the request is initiated.

Use the absolute URL
Don't use a relative URL for your url parameter value.

Value type

string

Example value

&url=http://www.example.com/index.html?q=dresses

Use case-dependent parameters

These parameters are for specific product search use cases. Each parameter has a section that tells you which use cases require the parameter.

callback

Indicates whether to return data wrapped in the function for cross-origin requests.

If you're running a server-side request, then use the value, br_server. If you're running a native-app request, then use the value, br_app.

Value type

string (enum)

Example value

&callback=br_server

 

Use case

Return data wrapped in the function for cross-origin requests.

 

efq

Applies a complex boolean filter to search results to include or exclude items that fit your parameter values. Any product attribute in your product feed is valid, such as brand names and sizes. Typically, the efq parameter is used for custom attributes that you include in your product feed to support additional business logic that you might need to filter.

 efq or fq?
Values for the efq parameter are similar to values for the fq parameter. The difference between efq and fq is that efq supports complex boolean searches and fq filters on facets. You can use the fq parameter with the efqparameter to apply more complex filtering.

Value type

string

Example value

&efq=color:"red" OR "purple" OR "pink"

 

 More information: efq syntax

Use case

Apply complex filtering to search results.

facet.range

Return a count of ranged facets, such as price and sale price. Use numeric attributes only.

Value type

string

Example value

&facet.range=sale_price

 

Use case

Apply ranged filtering to search results.

fq

The fq parameter applies a faceted filter to the returned products, searching for products that fit your parameter values. Any facet that you want to filter must be in your product feed.

Attributes must be enabled and mapped by Bloomreach
Let your Bloomreach representative know which attributes in your product feed that you want to apply as filters to search results.

The  fq  parameter filters results to include only relevant items. For example, a major sports league has a website store that sells products to fans for every team in the league. The league has 32 teams, and each team has its own hats, t-shirts, jerseys,  tchotchkes, cups, and many other items. Showing all of these items to a customer is overwhelming, causing customers difficulty when they try to find exactly what they're looking for. You can use the fq parameter in your API calls to suggest to customers only items from their own teams.

Surround individual attributes in fq values with double quotes. If you are using multiple attribute in your fq value, then separate the attributes with OR or AND.

Value type

string

Example value

&fq=color:"red" OR "purple" OR "pink"

> More information: fq syntax
 

Surround attributes in your value with quotes. For example:

brand:"Fossil"

If the attribute in the efq parameter contains a space, surround the attribute with quotes. For example:

"Product Type":"1"

If you have multiple values, then surround the entire value with parentheses. For example:

brand:("Fossil" OR "Betsey Johnson")

Please note that if the value has quote within it, then the quote should be escaped with '\', e.g. Sheet Dimension = 8.5" x 11".

In this case the fq should be:

Sheet Dimension:"8.5\" x 11\""

In this case the efq should be:

"Sheet Dimension":"8.5\" x 11\""

To apply filters for a ranged facet, such as price or sale price, the ranged value needs to be specified in addition to the product attribute.

For example: to limit results to products with a price below 100:

price:[* TO 100]

Or to limit results to products with a price between 200 and 300:

price:[200 TO 300]

Use case

Apply filtering to search results.

sort

Sorts results based on the field value in ascending, descending, or another combination of orders. You can use one of the following values:

  • sale_price desc sorts in descending order of the sale price

  • sale_price asc sorts in ascending order of the sale price

  • price desc sorts in descending order of the price

  • price asc sorts in ascending order of the price

  • launch_date desc sorts in descending order of the date on which products launched

  • launch_date asc sorts in descending order of the date on which products launched

Value type

string (enum)

 

Use case

Sort search results by certain attributes.

user_id

The universal customer ID of the user. You only need to pass this field if your particular integration tracks customers this way.

The parameter captures user IDs from the customer side, and reuses the information when powering apps or enhancing cross-device linking. In this way, Bloomreach recognizes users in a way that's aligned with your system. Use an anonymous string. Don't use email or other personally identifiable information. If you do not track users this way, then omit this field.

Value type

string

Example value

&user_id=947345478564

 

Track individual site visitor behavior.

view_id

A unique identifier for a specific view of your product catalog. If you have multiple versions of your site, each with their own product catalog characteristics like product titles and prices, then add view_id to your call. Bloomreach uses your view_id parameter value to display the right product information for your customers based on their individual site views.

You can enter any string value to identify the specific site catalog view. This string must be consistent in your pixel, API, and product catalog. For example, Abacus Thinking sells different academic products to different grade levels. A first grade teacher looks in their Kindergarten through Grade 3 catalog, which Abacus Thinking assigns the ID, k-3:

&view_id=k-3

Consistent, valid values

Your view_id values must be the same in your API, pixel, and product catalog. If Abacus Thinking assigns the value, ACA-MAX, to the view_id parameter in their product feed, then the parameter value, academia maximiliano, doesn't match any catalog view.

Value type

string

 

Use case

Search a specific view of a site with multiple versions.

widget_id

This widget_id is provided via the brSM dashboard under "Dynamic Widgets" to fulfill certain usecases where the results need to be independently curated by business users. This is an optional feature that can be enabled by discussing with your CSM.

Example

&widget_id=<hex widget ID from brSM dashboard>

Use case

Retrieve a specific Dynamic Widget based result set using a widget_id

wt

Specifies the type of response. Use one of the following values:

  • json is the default response type

  • html requires an html template integration

Value type

string (enum)

Example value

&wt=html

 

Use case

Return results in HTML.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?