Display the list from the REST API
The response from the REST API is a JSON object that contains the list of recommendations, formatted as described in this section. Use the examples and descriptions in this section when you construct the code that will display the results.
Example
{
"io":
{
"clientid": "00000002",
"offer_id": 10,
"offer_type": "P",
"offer_name": "Product_Cross_Sell",
"target_id": "FULO-0101",
"offer_version": "2016061311",
"attributes": [
{"name": "Product Name", "format": "string", "prefix": ""},
{"name": "Price", "format": "string", "prefix": "$"},
{"name": "Product Image", "format": "string", "prefix":
"http://iocdn.coremetrics.com/prodqa/"}],
"rec_count": 3,
"recs": [
{"id": "FULO-0201", "score": 867.96, "category": "CHAISES", "rank": 1,
"Product Name": "RED LEATHER ROLL ARM CHAISE", "Price": "105",
"Product Image": "images/FULO-0201.jpg"},
{"id": "FUDE-0101", "score": 758.2, "category": "DESKS", "rank": 2,
"Product Name": "EXECUTIVE SIX-DRAWER DESK", "Price": "100",
"Product Image": "images/FUDE-0101.jpg"},
{"id": "FUDEL-0201", "score": 653.78, "category": "LAMPS", "rank": 3,
"Product Name": "DEVINE DESK LAMP", "Price": "103",
"Product Image": "images/FUDEL-0201.jpg"}]
},
"message": {"code": 200, "text": "OK", "version": "V9"}
Response parameters
The following table defines the parameters in the response from the REST API.
| Field | Type | Definition |
|---|---|---|
| io | Node | Contains all the recommendation data. |
| clientid | Node | Your client ID. |
| offer_type | Node | The type of offer, indicated by one of the following
codes:
|
| offer_name | Node | The name of the offer. |
| offer_version | Node | The offer version, as indicated by a timestamp
with the following format: YYYYMMDDHHMISS |
| target_id | Node | The ID of the target. |
| attributes | List | The list of available attributes. |
| attributes.name | Node | Name of attribute. |
| attributes.format | Node | Format of attribute. |
| attributes.prefix | Node | If the attribute has a prefix that is configured, its value. For example, for a price attribute, a currency symbol ($). |
| rec_count | Node | The number of recommendations that is included in the list. |
| recs | List | List of recommendations. |
| recs.id | Node | The ID of the recommended item. |
| recs.category | Node | The category of the recommended item. |
| recs.score | Node | The affinity score that is calculated for the item in the context of the target. |
| recs.rank | Node | The rank of the recommended item as a 1-based number. |
| recs.attribute | Node | An unbounded list of attribute name-value pairs that are based on number of available attributes. |
Response codes
The REST API also returns one of the following HTTP response codes.
| Response code | Message | Description |
|---|---|---|
| 200 | OK | The request was successful. |
| 404 | Error | The URL was incorrect or not found. |
| 500 | Error | There was an error on the server and the request did not succeed. |