Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Method Objective
The method returns an API response when requesting product recommendations.
Request
Endpoint | Request Type |
---|---|
https://api.personaclick.com/recommend/{% recommender_code %} | GET |
Parameters
Name | Type | Requirement | Description |
---|---|---|---|
recommender_code | string | required | Unique code of the recommendation block. See this value in the "data-recommender-code" attribute of the block created in PersonaClick account. The parameter builds the endpoint for the recommendation request. |
shop_id | string | required | Unique Store Key in PersonaClick. Located there: Account > Settings > Store Settings |
did | string | required | Unique Device ID. See "Initialization (REST API)" for information about getting and using Device ID. |
seance | string | required | Unique ID of the current user session. See "Initialization (REST API)" for information about getting and using User Session ID. |
segment | string | optionally | Can take one of the values: "A" or "B" according to the segment to which the user is assigned. You can use your algorithm to divide users evenly between the segments. |
item | number/string | required in some cases | Product ID. |
This parameter is mandatory for the requests of blocks with algorithms that |
depend on the current product. Algorithms: "Similar |
", "Products usually purchased with this product", "Store recommendations", etc. | |||
exclude | string | optionally | Product IDs (splitted by comma), which should be excluded from the recommended products list. |
category | number/string | required in some cases | Category ID. This parameter is mandatory for all blocks set on category pages. |
search_query | string | required in some cases | The text of the search query. This parameter is mandatory for the requests of blocks that use the "Search" algorithm. |
limit | number | optionally | A maximum number of products in the API response. |
locations | string | optionally | Location IDs, splitted by comma. If used, the API response will return products available in the listed locations. |
brands | string | optionally | Brand names, splitted by comma. If used, only the products of the listed brands will be returned in the API response. |
exclude_brands | string | optionally | Brand names, splitted by comma. If used, the API response will exclude the products of the listed brands. |
categories | string | optionally | Category IDs, splitted by comma. If used, the API response will only return products that are included in the listed categories. |
discount | boolean | optionally | If used with "true" value, then only those products, the value of which is less than the "oldprice" value, will be returned in the API response. |
resize_image | number | optionally | Product Image Size. Available values (px): 120, 140, 160, 180, 200, 220. The default is the original size. |
extended |
boolean | optionally |
Allows getting extended information about products for self-rendering of the recommended products widget. See the "recommends" property of the API response. Default: false | |||
prevent_shuffle | boolean | optionally | If set to true value this will disable product shuffling in the API response. |
page | number | optionally | Used when pagination is needed. The API returns products of the specified page and limit (limit is set in the block's settings in the account or as an additional parameter in the request). |
API Response Code
HTTP status code | Description |
---|---|
200 OK | The request was successful. |
404 Not Found | There are no mandatory parameters in the |
request. |
API Response Data
The API returns an array of category objects. Below are the properties of a single object.
Name | Type | Description |
---|---|---|
html | string | HTML-code of the block with products. The template is customized in the PersonaClick account. |
title | string | The block title. Corresponds to the value of the "Action" element in the block rules. |
recommends |
Array/Object Array | Depending on the value of the "extended" parameter in the API request, it returns either an Array or an Object Array. The Array contains only product IDs. The Object Array contains objects with the following properties:
| |
id | number | Unique block identifier. Corresponds to the block ID in the list of blocks in the PersonaClick account. |
snippet | string | JS snippet code attached to the recommender. |
Request Examples
For blocks with algorithms that require the "Product ID":
Code Block | ||||
---|---|---|---|---|
| ||||
curl 'https://api.personaclick.com/recommend/1fd1b3495137bc3c9299816026acf36f?shop_id=0d42fd8b713d0752776ca589cc0056&did=iVxRcAaGzA&seance=C6vpfZPlpz&segment=A&item_id=100500' |
For blocks with algorithms that require the "Category ID":
Code Block | ||||
---|---|---|---|---|
| ||||
curl 'https://api.personaclick.com/recommend/1fd1b3495137bc3c9299816026acf36f?shop_id=0d42fd8b713d0752776ca589cc0056&did=iVxRcAaGzA&seance=C6vpfZPlpz&segment=A&category=146' |
For blocks with an algorithm that requires the "Search Query":
Code Block | ||||
---|---|---|---|---|
| ||||
curl 'https://api.personaclick.com/recommend/1fd1b3495137bc3c9299816026acf36f?shop_id=0d42fd8b713d0752776ca589cc0056&did=iVxRcAaGzA&seance=C6vpfZPlpz&segment=A&search_query=To%20be%20or%20not%20to%20be' |
Full example:
Code Block | ||||
---|---|---|---|---|
| ||||
curl 'https://api.personaclick.com/recommend/1fd1b3495137bc3c9299816026acf36f?shop_id=0d42fd8b713d0752776ca589cc0056&did=iVxRcAaGzA&seance=C6vpfZPlpz&segment=A&search_query=To%20be%20or%20not%20to%20be&category=146&categories=1%2C146%2C100500&exclude=3%2C14%2C159%2C26535&item_id=60496856&limit=15&brands=Alas%2Cpoor%2CYorick' |
&extended=true |
Column | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Page Navigation
Related Pages
|