Requesting product recommendations via XML / JSON
The recommendations made by the Recommendation Engine can be requested via an XML interface, just like the search results.
To request recommendations, call the following URL:
$stringEscapeUtils.escapeHtml($body)
URL parameters
id=[ProductID]
You use this parameter to pass the product ID for which you wish to obtain recommendations. If you have multiple IDs within your Data (e.g. article number, master article number, EAN) please ask ask your project manager which IDs should be passed.
Should you import sales date via tracking, then the number corresponds with the passed product ID.
This parameter can be supplied multiple times if you wish to generate recommendations for multiple reference products:
$stringEscapeUtils.escapeHtml($body)
channel=[NAME]
The name of the FACT-Finder search channel in which the products are located. The default channel is used if the parameter is not specified.
sid=[SessionID]
This parameter is used to pass a name for the user session. This is important for recognising the user, if you want to give him personalised recommendations, as well as for FACT-Finder tracking.
maxResults=[NUMBER]
Use this parameter to specify the number of recommendations you would like. The default value from the configuration is used if the parameter is not specified.
idsOnly=[true|false]
If the value true
is passed, then only the record IDs will be returned, streamlining the results. If you do not need the other information in the results, this will help you to improve performance.
XML output
By default the data returned via the HTTP interface is sent in XML format. However you can also request this explicitly by passing the parameter format=xml
. The output format is based on the output format of the search results, so you may be able to use the same parser.
Below is an example of the output. See the Search Integration Documentation for more details.
<ff xsi:noNamespaceSchemaLocation="schema/7.2/ffrecommender.xsd">
<recommendationTimedOut>false</recommendationTimedOut>
<results count="10">
<record nr="0" id="7100-4851">
<field name="EAN">4008670221523</field>
<field name="Category">DVD</field>
...
</record>
...
</results>
</ff>
JSON output
If you wish to receive the interface output in JSON format, you must supply the parameter format=json
with the URL. Again, the format used here is based on the search results output and returns a list of record
objects.
A schema of the JSON output can be found under the following URL:
$stringEscapeUtils.escapeHtml($body)
An output example could look as follows:
[
"resultRecords" : [
{
"id": "ed6a4182...",
"record": {
...
}
},
...
],
"timedOut": false
]