API
This page contains the API definition. See tab Interfaces for information on how to use the API.
Methods
Optional arguments denoted with square brackets.
Return Method Description JavaScript Arguments JSON Arguments
Predictions getCartPredictions Returns predictions based on the products in a shopping cart. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getClickstream Returns the products in the current session's clickstream. TemplateName [DynamicParameters] [ColumnNames] SessionID TemplateName [DynamicParameters] [ColumnNames]
Predictions getClickstreamPredictions Returns predictions based on the current session's clickstream. TemplateName [DynamicParameters] [ColumnNames] SessionID TemplateName [DynamicParameters] [ColumnNames]
Predictions getLandingPagePredictions Returns predictions for a search phrase used on an external web search engine. SearchPhrase TemplateName [DynamicParameters] [ColumnNames] SessionID SearchPhrase TemplateName [DynamicParameters] [ColumnNames]
Products getProducts Returns products. Used to choose what products to display. TemplateName [DynamicParameters] [ColumnNames] TemplateName [DynamicParameters] [ColumnNames]
Predictions getProductsPredictions Returns predictions for one or more products. When the input contains only one product it also collects clickstreamdata. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getProductsPredictionsFromClicks Returns predictions for one or more products. When the input contains only one product it also collects click data. ProductIDs TemplateName [DynamicParameters] [ColumnNames] SessionID ProductIDs TemplateName [DynamicParameters] [ColumnNames]
Predictions getSearchPredictions Returns predictions for a search phrase. SearchPhrase TemplateName [DynamicParameters] [ColumnNames] SessionID SearchPhrase TemplateName [DynamicParameters] [ColumnNames]
Predictions getTwinsumers Returns users that have a similar order history as the given user. UserID NrToReturn SessionID UserID NrToReturn
Predictions getUserPredictions Returns predictions for a user. UserID TemplateName [DynamicParameters] [ColumnNames] SessionID UserID TemplateName [DynamicParameters] [ColumnNames]
Status logAddedToCart Logs the event that a user adds a product to the shopping cart. If the product is a recommended product, then the TrackingCode argument should be used. If it is a non-recommended product, then TrackingCode should not be used. ProductID [TrackingCode] SessionID ProductID [TrackingCode]
Status logClickedOn Logs the event that a user clicks on a predicted product. Also collects clickstreamdata and click data. ProductID TrackingCode SessionID ProductID TrackingCode
Status registerSession Registers a session. Not available in JavaScript SessionID
Status logPurchase Logs the event that a user makes a purchase. UserID ProductIDs Prices [OrderID] [Currency] SessionID UserID ProductIDs Prices [OrderID] [Currency]
Status saveLandingPageData Saves a landing page phrase. Predictions for landing pages are based on these. SearchPhrase ProductID SearchPhrase ProductID
Status saveSearch Saves a search to the server. Predictions for searches are based on these. SearchPhrase ProductID SearchPhrase ProductID
Status setProductValidity Sets if a specific product can be recommended or not. Invalid products are filtered out by using a template with the Only Valid setting set to True Not available in JavaScript ProductID Valid
Arguments
Name Primitive Description
ColumnNames String[] The names of the product data columns to return.
Currency AlphNumString A three letter code denoting a currency according to ISO 4217 standard (USD, EUR, SEK, DKK, etc.). See Wikipedia for details about ISO 4217.
DynamicParameters String[] An array of dynamic parameters that are applied to the argument template. Each position in the array is a dynamic parameter. Dynamic parameter syntax: "[append/replace] [andcat/orcat/notcat/rule] in subtemplate [subtemplate number] with [data]". Note that if you append to an existing rule you have to add and or or to the beginning of the added rule. Example: "append rule in subtemplate 2 with and Price<10". Example: "replace notcat in subtemplate 1 with Hardback". Multiple categories can be passed in one dynamic parameter separated with comma: Example: "replace andcat in subtemplate 3 with Drama,DVD,OnSale".
NrToReturn A whole number between 0 and 2,147,483,647. The maximum number of elements to return.
OrderID AlphNumString A unique order identifier of an order as used in the implementing system.
Prices AlphNumString[] Array of prices that is purchased. Dot denotes decimal. Must be in the same order as the products. Must not be empty. Do not include taxes, shipment and handling or other charges outside the actual product price. All prices submitted must be in the same currency.
ProductID AlphNumString A unique identifier of a product.
ProductIDs AlphNumString[] A unique identifier of a product.
SearchPhrase String The complete search phrase that the user entered into the search field. Must not be empty.
SessionID AlphNumString A unique session identifier as used in the implementing system. JSON session identifier is retrieved from the __avail_session__ browser cookie.
TemplateName AlphNumString The name of the template.
TrackingCode AlphNumString Server generated tracking code. The tracking code is returned from server with a predictions request.
UserID AlphNumString A unique identifier of a user.
Valid Boolean Changes the validity of a product.
Returns
Predictions
  • In the values variable an ordered list of products or user identifiers is returned. The most highly ranked result first, then in descending order.
  • In the trackingcode variable the tracking code for the current predictions request is returned.
    Products
  • In the values variable a list of products is returned. The products returned are based on Column to Sort On and Sort Order. Sort On and Sort Order are set on the template.
  • Status
    The values variable hold the status of the operation.
    Primitives
    Name Description
    AlphNumString Allowed characters in AlphNumString are the alphanumeric characters and underscore, at sign, full stop and hyphen-minus. The alphanumeric character set consists of the numbers 0 to 9 and letters A to Z in the English alphabet case-sensitive. The maximum length is 500 characters.
    AlphNumString[] Allowed value is an array of AlphNumString. The maximum length of the array is 10000 elements.
    Boolean Has only two possible values: true and false.
    String Allowed values are arbitrary characters. Reserved values are the null value 'null' and the crypto prefix '_enc_'. The maximum length is 500 characters.
    String[] Allowed value is an array of Strings. The maximum length of the array is 10000 elements.