« Back to API reference

Product recommendation API

Product based recommendations

Format of the API request:

URL: https://[customer_domain].custobar.com/api/recommendations/[product_id]/[type_of_recommendation]/?[extra_parameter]&[extra_parameter2]

type_of_recommendation

This parameter can have 4 different values: similar, bought, viewed or all. All will return all types.

extra_parameters

ids_only=1 -> API returns only IDs of the recommended products. Otherwise it will return all product data in Custobar of the recommended products as JSON.

count=x -> you can specify the number of products you want to receive

boost=1 -> boosts similar products (brand, category, type etc) higher. Boosted fields can be configured from company settings. Used in bought & viewed products.

category | type | brand = -> can be used for filtering results

Some examples:

Other customers bought also these products (in these examples: Product ID = 0375704027):

- GET https://test.custobar.com/api/recommendations/0375704027/bought/ids_only=1

Example response

Response 1

Filter recommendations with product type:

- https://test.custobar.com/api/recommendations/0375704027/bought/?ids_only=1&type=Hard+Cover

Other customers viewed also these products:

- https://test.custobar.com/api/recommendations/0375704027/viewed/?ids_only=1

Similar products:

- https://test.custobar.com/api/recommendations/0375704027/similar/?ids_only=1

Top products

Most sold products (returns product ID and count)

- https://test.custobar.com/api/products/bought/

Example response

Response 2

- https://test.custobar.com/api/products/bought/?category=Tablet

- https://test.custobar.com/api/products/bought/?brand=asus

- https://test.custobar.com/api/products/bought/?brand=hp&date=2016-01-01_2017-01-01

Most viewed products (returns product ID and count)

- https://test.custobar.com/api/products/viewed/

- https://test.custobar.com/api/products/viewed/?category=Tablet

- https://test.custobar.com/api/products/viewed/?brand=samsung

- https://test.custobar.com/api/products/viewed/?brand=hp&date=2016-01-01_2017-01-01

You can also include count, i.e:

- https://test.custobar.com/api/products/bought/?brand=asus&count=5

- https://test.custobar.com/api/products/bought/?brand=asus&count=50

Personalized product recommendations for customer

https://test.custobar.com/api/customers/[Customer ID]/recommendations/?ids_only=1&count=10

Example:

https://test.custobar.com/api/customers/294168/recommendations/?ids_only=1

Please note: The personalized product recommendations do not currently utilize the Custobar cookie information. The website has to always know the customer ID when requesting recommendations.