Mobiplus Recommender API
We have 2 ways available to interface with the Mobiplus Recommendation Engine
API Mode
Download data from recommendation API:
- recommendation.js file should be added to the website.
- With the above API we can get Recommendations by giving parameters the id of the customer or the id of one or more products.
- Also for the Recommendation Engine to work properly we need to send some basic data in every transaction.
- Below are examples of the above functions.
Receive data from recommendation API.
Parameters of the following functions are the client's userid and the token which we provide.
In case we don't know the customer because they haven't signed in then we call the following function with NULL userid.
Receive data in JSON format
get_user_items_json(userid,token);
Receive data in HTM format
get_user_items_html(userid,token);
Receive Recommendation based on products.
Parameters of the following functions are the code of the product(s).
In case we have more than 1 product, then the List should be a string with the ids of the products separated by a comma “,”, e.g.
list=108,109,150,286;
The token parameter is a string which we give you.
Receive data in JSON format
get_history_items_json(list,token);
Receive data in HTM format
get_history_items_html(list,token);
Send data to recommendation engine
Sending data during the transaction of a customer who has signed in or unknown.
In this case we call the function:
item_click(userid,itemid,clicktype,sessionid,token);
Parameter | Information | |||
userid | Your customer's password (blank if they have not signed in). | |||
itemid | Product code. | |||
clicktype | A string with one of two values (basket, favorite). | |||
basket | The price is given when the product is added to the shopping cart, | |||
favorite | Given in case it has been added to the wish list. | |||
Sessionid | It is the code of the session currently created for your customer |
Operation Rest Web Service
By calling the REST Web Service with the corresponding parameters we have the following possibilities:
The values of the parameters: clientid, projectid, date, will be given by us.
Tokencreation
Required for calling the other WebServices
/clienttoken?client_id= clientid&project_id= projectid&exp_date=date
Recommendation Web Service:
/reco?itemsid= itemsid&userid= userid&sessionid=sessionid&token= token
Parameter | Information | |||
itemsid | In case of more than one product id there should be a “,” comma separating the ids. E.g. itemsid = 108 or itemsid= 108,109,250,456 | |||
userid | The parameter is the id of the registered user. | |||
sessionid | The sessionid parameter is the sessionid that your client is currently using. | |||
token | The parameter can be retrieved using the previous WS “clienttoken”. |
The itemsid and userid parameters can also be NULL.
The sessionid and clienttoken parameters are mandatory.
Every time the customer clicks on a product then you should call the WS below giving the corresponding reason for clicking on a product.
/clickinsert?userid= userid&itemid=itemid&clicktype=clicktype&sessionid=sessionid&token=token
Parameter | Information | ||
userid | The parameter is the id of the registered user. | ||
itemid | The parameter is the id of the product. | ||
clicktype | The parameter is the reason for clicking and can be one of the following values: clicktype = click or favorite or wishlist or basket |
The sessionid parameter is the sessionid your client is currently using.
The token parameter can be retrieved using the previous WS “clienttoken”.
Only the userid parameter can be empty.
All other parameters are mandatory.
New Product Sales
/saleinsert?itemid=itemid&userid=userid&sessionid=sessionid&purchaseprice=purchaseprice&name=name&timestamp=timestamp&token=token
Parameter | Information | |||
itemid | The parameter is the id of the product. | |||
userid | The parameter is the id of the registered user. | |||
sessionid | The parameter is the sessionid, which your customer is currently using. | |||
purchaseprice | The parameter is the price of the product. | |||
name | The parameter is the name of the product. | |||
timestamp | The parameter is the timestamp of the purchase. E.g. “2021-3-22 19:30:10”. | |||
token | The parameter can be retrieved using the previous WS “clienttoken”. |
All other parameters are mandatory.